···483483 * @public @memberof os_thread_helper
484484 */
485485static inline int
486486-os_thread_helper_stop(struct os_thread_helper *oth)
486486+os_thread_helper_stop_and_wait(struct os_thread_helper *oth)
487487{
488488 void *retval = NULL;
489489···515515/*!
516516 * Destroy the thread helper, externally synchronizable.
517517 *
518518- * Integrates a call to @ref os_thread_helper_stop, so you may just call this for full cleanup
518518+ * Integrates a call to @ref os_thread_helper_stop_and_wait, so you may just call this for full cleanup
519519 *
520520 * @public @memberof os_thread_helper
521521 */
···524524{
525525 assert(oth->initialized);
526526 // Stop the thread.
527527- os_thread_helper_stop(oth);
527527+ os_thread_helper_stop_and_wait(oth);
528528529529 // Destroy resources.
530530 pthread_mutex_destroy(&oth->mutex);
···937937938938 // Thread if it has been started must be stopped first.
939939 if (cts->vblank.has_started) {
940940- os_thread_helper_stop(&cts->vblank.event_thread);
940940+ // Destroy also stops the thread.
941941 os_thread_helper_destroy(&cts->vblank.event_thread);
942942 cts->vblank.has_started = false;
943943 }
+3-2
src/xrt/compositor/main/comp_window_mswin.c
···9191comp_window_mswin_destroy(struct comp_target *ct)
9292{
9393 struct comp_window_mswin *cwm = (struct comp_window_mswin *)ct;
9494- // Stop the Windows thread first.
9595- os_thread_helper_stop(&cwm->oth);
9494+9595+ // Stop the Windows thread first, destroy also stops the thread.
9696+ os_thread_helper_destroy(&cwm->oth);
96979798 comp_target_swapchain_cleanup(&cwm->base);
9899
···208208209209 if (survive->sys->hmd == NULL && all_null) {
210210 U_LOG_D("Tearing down libsurvive context");
211211- os_thread_helper_stop(&survive->sys->event_thread);
211211+212212+ // Destroy also stops the thread.
212213 os_thread_helper_destroy(&survive->sys->event_thread);
213214214215 // Now that the thread is not running we can destroy the lock.
+3-1
src/xrt/drivers/ultraleap_v2/ulv2_driver.cpp
···369369 struct ulv2_device *ulv2d = ulv2_device(xdev);
370370371371 ulv2d->pthread_should_stop = true;
372372- os_thread_helper_stop(&ulv2d->leap_loop_oth);
372372+373373+ // Destroy also stops the thread.
374374+ os_thread_helper_destroy(&ulv2d->leap_loop_oth);
373375374376 // Remove the variable tracking.
375377 u_var_remove_root(ulv2d);
+1-1
src/xrt/drivers/vf/vf_driver.c
···401401{
402402 g_main_loop_quit(vid->loop);
403403404404- os_thread_helper_stop(&vid->play_thread);
404404+ // Destroy also stops the thread.
405405 os_thread_helper_destroy(&vid->play_thread);
406406407407 free(vid);
+2-1
src/xrt/targets/cli/cli_cmd_slambatch.c
···7474 timepoint_ns end_time = os_monotonic_get_ns();
75757676 pthread_cancel(wfk_thread.thread);
7777- os_thread_helper_stop(&wfk_thread);
7777+7878+ // Destroy also stops the thread.
7879 os_thread_helper_destroy(&wfk_thread);
79808081 printf("Done in %.2fs.\n", (double)(end_time - start_time) / U_TIME_1S_IN_NS);