File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -848,6 +848,11 @@ CAMLexport int caml_c_thread_register(void)
848
848
}
849
849
/* Associate the thread descriptor with the thread */
850
850
st_tls_set (caml_thread_key , (void * ) th );
851
+
852
+ /* Prepare Caml_state for allocation etc., so its various members correspond
853
+ to those for the newly-registered thread */
854
+ restore_runtime_state (th );
855
+
851
856
/* Allocate the thread descriptor on the heap */
852
857
th -> descr = caml_thread_new_descriptor (Val_unit ); /* no closure */
853
858
@@ -856,6 +861,9 @@ CAMLexport int caml_c_thread_register(void)
856
861
sync_check_error (err , "caml_register_c_thread" );
857
862
}
858
863
864
+ /* Save any modifications to Caml_state back to the thread descriptor */
865
+ save_runtime_state ();
866
+
859
867
/* Release the master lock */
860
868
thread_lock_release (Dom_c_threads );
861
869
return 1 ;
You can’t perform that action at this time.
0 commit comments