Skip to content

Commit

Permalink
Make use of dt_pthread_join for better log reports and debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshannoschwalm committed Jan 4, 2025
1 parent c14f0fe commit 6842eee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/common/camera_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ void dt_camctl_camera_stop_live_view(const dt_camctl_t *c)
}
dt_print(DT_DEBUG_CAMCTL, "[camera_control] Stopping live view");
cam->is_live_viewing = FALSE;
pthread_join(cam->live_view_thread, NULL);
dt_pthread_join(cam->live_view_thread);
// tell camera to get back to normal state (close mirror)
dt_camctl_camera_set_property_int(camctl, NULL, "eosviewfinder", 0);
dt_camctl_camera_set_property_int(camctl, NULL, "viewfinder", 0);
Expand Down
8 changes: 4 additions & 4 deletions src/control/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void dt_control_shutdown(dt_control_t *s)
int err = 0; // collect all joining errors
/* first wait for gphoto device updater */
#ifdef HAVE_GPHOTO2
err = pthread_join(s->update_gphoto_thread, NULL);
err = dt_pthread_join(s->update_gphoto_thread);
#endif

if(!cleanup)
Expand All @@ -342,18 +342,18 @@ void dt_control_shutdown(dt_control_t *s)
dt_print(DT_DEBUG_CONTROL, "[dt_control_shutdown] closing control threads");

/* then wait for kick_on_workers_thread */
err = pthread_join(s->kick_on_workers_thread, NULL);
err = dt_pthread_join(s->kick_on_workers_thread);
dt_print(DT_DEBUG_CONTROL, "[dt_control_shutdown] joined kicker%s", err ? ", error" : "");

for(int k = 0; k < s->num_threads-1; k++)
{
err = pthread_join(s->thread[k], NULL);
err = dt_pthread_join(s->thread[k]);
dt_print(DT_DEBUG_CONTROL, "[dt_control_shutdown] joined num_thread %i%s", k, err ? ", error" : "");
}

for(int k = 0; k < DT_CTL_WORKER_RESERVED; k++)
{
err = pthread_join(s->thread_res[k], NULL);
err = dt_pthread_join(s->thread_res[k]);
dt_print(DT_DEBUG_CONTROL, "[dt_control_shutdown] joined worker %i%s", k, err ? ", error" : "");
}
}
Expand Down

0 comments on commit 6842eee

Please sign in to comment.