Let's work! Computation, entering f Entering g Entering h and perform-ing In the effect handler ================== WARNING: ThreadSanitizer: data race (pid=) Write of size 8 at by main thread (mutexes: write M): #0 camlPerform.race_ () #1 camlPerform.fun_ () #2 camlPerform.main_ () #3 camlPerform.entry () #4 caml_program () Previous read of size 8 at by thread T1 (mutexes: write M): #0 camlPerform.other_domain_ () #1 camlStdlib__Domain.body_ () As if synchronized via sleep: #0 usleep () #1 wg_wait () #2 camlPerform.entry () #3 caml_program () Mutex M () created at: #0 pthread_mutex_init () #1 caml_plat_mutex_init () #2 caml_init_domains () #3 caml_init_gc () Mutex M () created at: #0 pthread_mutex_init () #1 caml_plat_mutex_init () #2 caml_init_domains () #3 caml_init_gc () Thread T1 (tid=, running) created by main thread at: #0 pthread_create () #1 caml_domain_spawn () #2 caml_c_call () #3 camlStdlib__Domain.spawn_ () #4 camlPerform.entry () #5 caml_program () SUMMARY: ThreadSanitizer: data race (:) in camlPerform.race_ ================== Resuming h ================== WARNING: ThreadSanitizer: data race (pid=) Write of size 8 at by main thread (mutexes: write M): #0 camlPerform.race_ () #1 camlPerform.h_ () #2 camlPerform.g_ () #3 camlPerform.f_ () #4 caml_runstack () #5 camlPerform.fun_ () #6 camlPerform.main_ () #7 camlPerform.entry () #8 caml_program () Previous read of size 8 at by thread T1 (mutexes: write M): #0 camlPerform.other_domain_ () #1 camlStdlib__Domain.body_ () As if synchronized via sleep: #0 usleep () #1 wg_wait () #2 camlPerform.entry () #3 caml_program () Mutex M () created at: #0 pthread_mutex_init () #1 caml_plat_mutex_init () #2 caml_init_domains () #3 caml_init_gc () Mutex M () created at: #0 pthread_mutex_init () #1 caml_plat_mutex_init () #2 caml_init_domains () #3 caml_init_gc () Thread T1 (tid=, running) created by main thread at: #0 pthread_create () #1 caml_domain_spawn () #2 caml_c_call () #3 camlStdlib__Domain.spawn_ () #4 camlPerform.entry () #5 caml_program () SUMMARY: ThreadSanitizer: data race (:) in camlPerform.race_ ================== Leaving h Leaving g Computation, leaving f Value handler ================== WARNING: ThreadSanitizer: data race (pid=) Write of size 8 at by main thread (mutexes: write M): #0 camlPerform.race_ () #1 camlPerform.fun_ () #2 camlPerform.fun_ () #3 camlPerform.main_ () #4 camlPerform.entry () #5 caml_program () Previous read of size 8 at by thread T1 (mutexes: write M): #0 camlPerform.other_domain_ () #1 camlStdlib__Domain.body_ () As if synchronized via sleep: #0 usleep () #1 wg_wait () #2 camlPerform.entry () #3 caml_program () Mutex M () created at: #0 pthread_mutex_init () #1 caml_plat_mutex_init () #2 caml_init_domains () #3 caml_init_gc () Mutex M () created at: #0 pthread_mutex_init () #1 caml_plat_mutex_init () #2 caml_init_domains () #3 caml_init_gc () Thread T1 (tid=, running) created by main thread at: #0 pthread_create () #1 caml_domain_spawn () #2 caml_c_call () #3 camlStdlib__Domain.spawn_ () #4 camlPerform.entry () #5 caml_program () SUMMARY: ThreadSanitizer: data race (:) in camlPerform.race_ ================== Handler after continue Result = 42 ThreadSanitizer: reported 3 warnings