373 |
|
|
374 |
{ |
{ |
375 |
scm_t_thread th; |
scm_t_thread th; |
376 |
SCM root, old_winds; |
SCM root; |
377 |
launch_data *data; |
launch_data *data; |
378 |
scm_thread *t; |
scm_thread *t; |
379 |
int err; |
int err; |
380 |
|
|
|
/* Unwind wind chain. */ |
|
|
old_winds = scm_dynwinds; |
|
|
scm_dowinds (SCM_EOL, scm_ilength (scm_root->dynwinds)); |
|
|
|
|
381 |
/* Allocate thread locals. */ |
/* Allocate thread locals. */ |
382 |
root = scm_make_root (scm_root->handle); |
root = scm_make_root (scm_root->handle); |
383 |
data = scm_malloc (sizeof (launch_data)); |
data = scm_malloc (sizeof (launch_data)); |
395 |
t->root = SCM_ROOT_STATE (root); |
t->root = SCM_ROOT_STATE (root); |
396 |
/* disconnect from parent, to prevent remembering dead threads */ |
/* disconnect from parent, to prevent remembering dead threads */ |
397 |
t->root->parent = SCM_BOOL_F; |
t->root->parent = SCM_BOOL_F; |
398 |
|
/* start with an empty dynwind chain */ |
399 |
|
t->root->dynwinds = SCM_EOL; |
400 |
|
|
401 |
/* In order to avoid the need of synchronization between parent |
/* In order to avoid the need of synchronization between parent |
402 |
and child thread, we need to insert the child into all_threads |
and child thread, we need to insert the child into all_threads |
425 |
scm_i_plugin_mutex_unlock (&thread_admin_mutex); |
scm_i_plugin_mutex_unlock (&thread_admin_mutex); |
426 |
} |
} |
427 |
|
|
|
/* Return to old dynamic context. */ |
|
|
scm_dowinds (old_winds, - scm_ilength (old_winds)); |
|
|
|
|
428 |
if (err) |
if (err) |
429 |
{ |
{ |
430 |
errno = err; |
errno = err; |