The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #12707 from jmid/domain-assert-failure

Fix assertion race condition in #11800

authored by

Gabriel Scherer and committed by
GitHub
8cc728b5 d73896d4

+9 -3
+3
Changes
··· 436 436 437 437 ### Bug fixes: 438 438 439 + - #11800, #12707: fix an assertion race condition in `install_backup_thread` 440 + (Jan Midtgaard, review by Gabriel Scherer) 441 + 439 442 - #12590, #12595: fix a race in `caml_collect_gc_stats_sample` 440 443 (B. Szilvasy, review by Gabriel Scherer) 441 444
+6 -3
runtime/domain.c
··· 1042 1042 #endif 1043 1043 1044 1044 if (di->backup_thread_running == 0) { 1045 - CAMLassert (di->backup_thread_msg == BT_INIT || /* Using fresh domain */ 1046 - di->backup_thread_msg == BT_TERMINATE); /* Reusing domain */ 1045 + uintnat msg; 1046 + msg = atomic_load_acquire(&di->backup_thread_msg); 1047 + CAMLassert (msg == BT_INIT || /* Using fresh domain */ 1048 + msg == BT_TERMINATE); /* Reusing domain */ 1047 1049 1048 - while (atomic_load_acquire(&di->backup_thread_msg) != BT_INIT) { 1050 + while (msg != BT_INIT) { 1049 1051 /* Give a chance for backup thread on this domain to terminate */ 1050 1052 caml_plat_unlock (&di->domain_lock); 1051 1053 cpu_relax (); 1052 1054 caml_plat_lock (&di->domain_lock); 1055 + msg = atomic_load_acquire(&di->backup_thread_msg); 1053 1056 } 1054 1057 1055 1058 #ifndef _WIN32