Early check to see if there's anything to do in set_state().
authorCarl Hetherington <cth@carlh.net>
Sat, 21 Jan 2023 21:29:51 +0000 (22:29 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 27 Feb 2023 13:47:25 +0000 (14:47 +0100)
src/lib/job.cc

index 6ec154c34b3804c7edc040367ce88ee1e0a7fdef..53527d265da66d99262d7924d6e0f16d7647dc1b 100644 (file)
@@ -344,6 +344,10 @@ Job::set_state (State s)
 
        {
                boost::mutex::scoped_lock lm (_state_mutex);
+               if (_state == s) {
+                       return;
+               }
+
                _state = s;
 
                if (_state == FINISHED_OK || _state == FINISHED_ERROR || _state == FINISHED_CANCELLED) {