@@ -89,12 +89,14 @@ struct caml_thread_struct {
89
89
value * gc_regs ; /* saved value of Caml_state->gc_regs */
90
90
value * gc_regs_buckets ; /* saved value of Caml_state->gc_regs_buckets */
91
91
void * exn_handler ; /* saved value of Caml_state->exn_handler */
92
-
92
+ char * async_exn_handler ; /* saved value of Caml_state->async_exn_handler */
93
93
#ifndef NATIVE_CODE
94
94
intnat trap_sp_off ; /* saved value of Caml_state->trap_sp_off */
95
95
intnat trap_barrier_off ; /* saved value of Caml_state->trap_barrier_off */
96
96
struct caml_exception_context * external_raise ;
97
97
/* saved value of Caml_state->external_raise */
98
+ struct caml_exception_context * external_raise_async ;
99
+ /* saved value of Caml_state->external_raise_async */
98
100
#endif
99
101
100
102
#ifdef POSIX_SIGNALS
@@ -199,6 +201,7 @@ static void save_runtime_state(void)
199
201
this_thread -> gc_regs = Caml_state -> gc_regs ;
200
202
this_thread -> gc_regs_buckets = Caml_state -> gc_regs_buckets ;
201
203
this_thread -> exn_handler = Caml_state -> exn_handler ;
204
+ this_thread -> async_exn_handler = Caml_state -> async_exn_handler ;
202
205
this_thread -> local_roots = Caml_state -> local_roots ;
203
206
this_thread -> local_arenas = caml_get_local_arenas (Caml_state );
204
207
this_thread -> backtrace_pos = Caml_state -> backtrace_pos ;
@@ -208,6 +211,7 @@ static void save_runtime_state(void)
208
211
this_thread -> trap_sp_off = Caml_state -> trap_sp_off ;
209
212
this_thread -> trap_barrier_off = Caml_state -> trap_barrier_off ;
210
213
this_thread -> external_raise = Caml_state -> external_raise ;
214
+ this_thread -> external_raise_async = Caml_state -> external_raise_async ;
211
215
#endif
212
216
}
213
217
@@ -220,6 +224,7 @@ static void restore_runtime_state(caml_thread_t th)
220
224
Caml_state -> gc_regs = th -> gc_regs ;
221
225
Caml_state -> gc_regs_buckets = th -> gc_regs_buckets ;
222
226
Caml_state -> exn_handler = th -> exn_handler ;
227
+ Caml_state -> async_exn_handler = th -> async_exn_handler ;
223
228
Caml_state -> local_roots = th -> local_roots ;
224
229
caml_set_local_arenas (Caml_state , th -> local_arenas );
225
230
Caml_state -> backtrace_pos = th -> backtrace_pos ;
@@ -229,6 +234,7 @@ static void restore_runtime_state(caml_thread_t th)
229
234
Caml_state -> trap_sp_off = th -> trap_sp_off ;
230
235
Caml_state -> trap_barrier_off = th -> trap_barrier_off ;
231
236
Caml_state -> external_raise = th -> external_raise ;
237
+ Caml_state -> external_raise_async = th -> external_raise_async ;
232
238
#endif
233
239
}
234
240
@@ -296,11 +302,13 @@ static caml_thread_t caml_thread_new_info(void)
296
302
th -> gc_regs = NULL ;
297
303
th -> gc_regs_buckets = NULL ;
298
304
th -> exn_handler = NULL ;
305
+ th -> async_exn_handler = NULL ;
299
306
300
307
#ifndef NATIVE_CODE
301
308
th -> trap_sp_off = 1 ;
302
309
th -> trap_barrier_off = 2 ;
303
310
th -> external_raise = NULL ;
311
+ th -> external_raise_async = NULL ;
304
312
#endif
305
313
306
314
return th ;
@@ -321,6 +329,8 @@ void caml_thread_free_info(caml_thread_t th)
321
329
use in this variable nor on the stack)
322
330
exn_handler: stack-allocated
323
331
external_raise: stack-allocated
332
+ async_exn_handler: stack-allocated
333
+ external_raise_async: stack-allocated
324
334
init_mask: stack-allocated
325
335
*/
326
336
caml_free_stack (th -> current_stack );
@@ -752,11 +762,11 @@ CAMLprim value caml_thread_yield(value unit)
752
762
with saving errno.)
753
763
*/
754
764
755
- caml_raise_if_exception ( caml_process_pending_signals_exn () );
765
+ ( void ) caml_raise_async_if_exception ( caml_process_pending_signals_exn (), "" );
756
766
save_runtime_state ();
757
767
st_thread_yield (m );
758
768
restore_runtime_state (This_thread );
759
- caml_raise_if_exception ( caml_process_pending_signals_exn () );
769
+ ( void ) caml_raise_async_if_exception ( caml_process_pending_signals_exn (), "" );
760
770
761
771
return Val_unit ;
762
772
}
0 commit comments