diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-06-12 00:27:33 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-06-14 23:43:13 +0200 |
| commit | a12a943c99ba4aba122f91c93b078d2e87146b32 (patch) | |
| tree | 93e149bc2d6f9c2ff98aa05c5d51e096dd0c6598 /src/lib/job_manager.cc | |
| parent | 6d2d4973ccd5d4c78414d28988a74dfa7287f001 (diff) | |
Use a new UISignal which checks thread safety slightly.3052-hang
This adds a wrapper around signals2::signal which checks that emission
happens from the GUI thread, for signals whose handlers must be called
in the UI thread. I'm not sure how helpful it really is but maybe it
catches some bad situations.
Diffstat (limited to 'src/lib/job_manager.cc')
| -rw-r--r-- | src/lib/job_manager.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/job_manager.cc b/src/lib/job_manager.cc index c429dab6e..735b8e797 100644 --- a/src/lib/job_manager.cc +++ b/src/lib/job_manager.cc @@ -93,7 +93,7 @@ JobManager::add(shared_ptr<Job> j) _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr<Job>(j))); + JobAdded.emit_ui(this, weak_ptr<Job>(j)); return j; } @@ -110,7 +110,7 @@ JobManager::add_after(shared_ptr<Job> after, shared_ptr<Job> j) _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr<Job>(j))); + JobAdded.emit_ui(this, weak_ptr<Job>(j)); return j; } @@ -178,7 +178,7 @@ JobManager::scheduler() i->resume(); } auto last = _last_active_job.lock(); - emit(boost::bind(boost::ref(ActiveJobsChanged), last ? last->json_name() : std::string{}, i->json_name())); + ActiveJobsChanged.emit_ui(this, last ? last->json_name() : std::string{}, i->json_name()); _last_active_job = i; have_running = true; } else if (!have_running && i->running()) { @@ -197,7 +197,7 @@ JobManager::job_finished() { boost::mutex::scoped_lock lm(_mutex); auto job = _last_active_job.lock(); - emit(boost::bind(boost::ref(ActiveJobsChanged), job ? job->json_name() : string{}, optional<string>())); + ActiveJobsChanged.emit_ui(this, job ? job->json_name() : string{}, optional<string>()); _last_active_job = {}; } @@ -257,7 +257,7 @@ JobManager::analyse_audio( _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr<Job>(job))); + JobAdded.emit_ui(this, weak_ptr<Job>(job)); } @@ -292,7 +292,7 @@ JobManager::analyse_subtitles( _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr<Job>(job))); + JobAdded.emit_ui(this, weak_ptr<Job>(job)); } @@ -309,7 +309,7 @@ JobManager::increase_priority (shared_ptr<Job> job) } _schedule_condition.notify_all(); - emit(boost::bind(boost::ref(JobsReordered))); + JobsReordered.emit_ui(this); } @@ -326,7 +326,7 @@ JobManager::decrease_priority(shared_ptr<Job> job) } _schedule_condition.notify_all(); - emit(boost::bind(boost::ref(JobsReordered))); + JobsReordered.emit_ui(this); } |
