2 * This software is part of the SBCL system. See the README file for
5 * This software is derived from the CMU CL system, which was
6 * written at Carnegie Mellon University and released into the
7 * public domain. The software is in the public domain and is
8 * provided with absolutely no warranty. See the COPYING and CREDITS
9 * files for more information.
17 #ifndef LISP_FEATURE_WIN32
23 #include <sys/types.h>
24 #ifndef LISP_FEATURE_WIN32
28 #ifdef LISP_FEATURE_MACH_EXCEPTION_HANDLER
29 #include <mach/mach.h>
30 #include <mach/mach_error.h>
31 #include <mach/mach_types.h>
35 #include "validate.h" /* for BINDING_STACK_SIZE etc */
39 #include "target-arch-os.h"
43 #include "genesis/cons.h"
44 #include "genesis/fdefn.h"
45 #include "interr.h" /* for lose() */
46 #include "gc-internal.h"
48 #ifdef LISP_FEATURE_WIN32
50 * Win32 doesn't have SIGSTKSZ, and we're not switching stacks anyway,
51 * so define it arbitrarily
56 #if defined(LISP_FEATURE_DARWIN) && defined(LISP_FEATURE_SB_THREAD)
57 #define DELAY_THREAD_POST_MORTEM 5
58 #define LOCK_CREATE_THREAD
61 #ifdef LISP_FEATURE_FREEBSD
62 #define CREATE_CLEANUP_THREAD
63 #define LOCK_CREATE_THREAD
66 #define ALIEN_STACK_SIZE (1*1024*1024) /* 1Mb size chosen at random */
68 #ifdef LISP_FEATURE_SB_THREAD
69 struct thread_post_mortem {
70 #ifdef DELAY_THREAD_POST_MORTEM
71 struct thread_post_mortem *next;
73 os_thread_t os_thread;
74 pthread_attr_t *os_attr;
75 os_vm_address_t os_address;
78 #ifdef DELAY_THREAD_POST_MORTEM
79 static int pending_thread_post_mortem_count = 0;
80 pthread_mutex_t thread_post_mortem_lock = PTHREAD_MUTEX_INITIALIZER;
82 static struct thread_post_mortem * volatile pending_thread_post_mortem = 0;
85 int dynamic_values_bytes=TLS_SIZE*sizeof(lispobj); /* same for all threads */
86 struct thread *all_threads;
87 extern struct interrupt_data * global_interrupt_data;
89 #ifdef LISP_FEATURE_SB_THREAD
90 pthread_mutex_t all_threads_lock = PTHREAD_MUTEX_INITIALIZER;
91 #ifdef LOCK_CREATE_THREAD
92 static pthread_mutex_t create_thread_lock = PTHREAD_MUTEX_INITIALIZER;
94 #ifdef LISP_FEATURE_GCC_TLS
95 __thread struct thread *current_thread;
99 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
100 extern lispobj call_into_lisp_first_time(lispobj fun, lispobj *args, int nargs);
104 link_thread(struct thread *th)
106 if (all_threads) all_threads->prev=th;
107 th->next=all_threads;
112 #ifdef LISP_FEATURE_SB_THREAD
114 unlink_thread(struct thread *th)
117 th->prev->next = th->next;
119 all_threads = th->next;
121 th->next->prev = th->prev;
126 initial_thread_trampoline(struct thread *th)
129 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
130 lispobj *args = NULL;
132 function = th->no_tls_value_marker;
133 th->no_tls_value_marker = NO_TLS_VALUE_MARKER_WIDETAG;
134 if(arch_os_thread_init(th)==0) return 1;
136 th->os_thread=thread_self();
137 #ifndef LISP_FEATURE_WIN32
138 protect_control_stack_guard_page(1);
141 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
142 return call_into_lisp_first_time(function,args,0);
144 return funcall0(function);
148 #ifdef LISP_FEATURE_SB_THREAD
149 #define THREAD_STATE_LOCK_SIZE \
150 (sizeof(pthread_mutex_t))+(sizeof(pthread_cond_t))
152 #define THREAD_STATE_LOCK_SIZE 0
155 #define THREAD_STRUCT_SIZE (thread_control_stack_size + BINDING_STACK_SIZE + \
157 THREAD_STATE_LOCK_SIZE + \
158 dynamic_values_bytes + \
160 THREAD_ALIGNMENT_BYTES)
162 #ifdef LISP_FEATURE_SB_THREAD
163 /* THREAD POST MORTEM CLEANUP
165 * Memory allocated for the thread stacks cannot be reclaimed while
166 * the thread is still alive, so we need a mechanism for post mortem
167 * cleanups. FIXME: We actually have three, for historical reasons as
168 * the saying goes. Do we really need three? Nikodemus guesses that
169 * not anymore, now that we properly call pthread_attr_destroy before
170 * freeing the stack. */
172 static struct thread_post_mortem *
173 plan_thread_post_mortem(struct thread *corpse)
176 struct thread_post_mortem *post_mortem = malloc(sizeof(struct thread_post_mortem));
177 gc_assert(post_mortem);
178 post_mortem->os_thread = corpse->os_thread;
179 post_mortem->os_attr = corpse->os_attr;
180 post_mortem->os_address = corpse->os_address;
181 #ifdef DELAY_THREAD_POST_MORTEM
182 post_mortem->next = NULL;
186 /* FIXME: When does this happen? */
192 perform_thread_post_mortem(struct thread_post_mortem *post_mortem)
194 #ifdef CREATE_POST_MORTEM_THREAD
195 pthread_detach(pthread_self());
198 gc_assert(!pthread_join(post_mortem->os_thread, NULL));
199 gc_assert(!pthread_attr_destroy(post_mortem->os_attr));
200 free(post_mortem->os_attr);
201 os_invalidate(post_mortem->os_address, THREAD_STRUCT_SIZE);
207 schedule_thread_post_mortem(struct thread *corpse)
209 struct thread_post_mortem *post_mortem = NULL;
211 post_mortem = plan_thread_post_mortem(corpse);
213 #ifdef DELAY_THREAD_POST_MORTEM
214 pthread_mutex_lock(&thread_post_mortem_lock);
215 /* First stick the new post mortem to the end of the queue. */
216 if (pending_thread_post_mortem) {
217 struct thread_post_mortem *next = pending_thread_post_mortem;
221 next->next = post_mortem;
223 pending_thread_post_mortem = post_mortem;
225 /* Then, if there are enough things in the queue, clean up one
226 * from the head -- or increment the count, and null out the
227 * post_mortem we have. */
228 if (pending_thread_post_mortem_count > DELAY_THREAD_POST_MORTEM) {
229 post_mortem = pending_thread_post_mortem;
230 pending_thread_post_mortem = post_mortem->next;
232 pending_thread_post_mortem_count++;
235 pthread_mutex_unlock(&thread_post_mortem_lock);
236 /* Finally run, the cleanup, if any. */
237 perform_thread_post_mortem(post_mortem);
238 #elif defined(CREATE_POST_MORTEM_THREAD)
239 gc_assert(!pthread_create(&thread, NULL, perform_thread_post_mortem, post_mortem));
241 post_mortem = (struct thread_post_mortem *)
242 swap_lispobjs((lispobj *)(void *)&pending_thread_post_mortem,
243 (lispobj)post_mortem);
244 perform_thread_post_mortem(post_mortem);
249 /* this is the first thing that runs in the child (which is why the
250 * silly calling convention). Basically it calls the user's requested
251 * lisp function after doing arch_os_thread_init and whatever other
252 * bookkeeping needs to be done
255 new_thread_trampoline(struct thread *th)
258 int result, lock_ret;
260 FSHOW((stderr,"/creating thread %lu\n", thread_self()));
261 check_deferrables_blocked_or_lose();
262 check_gc_signals_unblocked_or_lose();
263 function = th->no_tls_value_marker;
264 th->no_tls_value_marker = NO_TLS_VALUE_MARKER_WIDETAG;
265 if(arch_os_thread_init(th)==0) {
266 /* FIXME: handle error */
267 lose("arch_os_thread_init failed\n");
270 th->os_thread=thread_self();
271 protect_control_stack_guard_page(1);
272 /* Since GC can only know about this thread from the all_threads
273 * list and we're just adding this thread to it, there is no
274 * danger of deadlocking even with SIG_STOP_FOR_GC blocked (which
276 lock_ret = pthread_mutex_lock(&all_threads_lock);
277 gc_assert(lock_ret == 0);
279 lock_ret = pthread_mutex_unlock(&all_threads_lock);
280 gc_assert(lock_ret == 0);
282 result = funcall0(function);
285 block_blockable_signals();
286 set_thread_state(th, STATE_DEAD);
288 /* SIG_STOP_FOR_GC is blocked and GC might be waiting for this
289 * thread, but since we are already dead it won't wait long. */
290 lock_ret = pthread_mutex_lock(&all_threads_lock);
291 gc_assert(lock_ret == 0);
293 gc_alloc_update_page_tables(BOXED_PAGE_FLAG, &th->alloc_region);
295 pthread_mutex_unlock(&all_threads_lock);
296 gc_assert(lock_ret == 0);
298 if(th->tls_cookie>=0) arch_os_thread_cleanup(th);
299 pthread_mutex_destroy(th->state_lock);
300 pthread_cond_destroy(th->state_cond);
302 os_invalidate((os_vm_address_t)th->interrupt_data,
303 (sizeof (struct interrupt_data)));
305 #ifdef LISP_FEATURE_MACH_EXCEPTION_HANDLER
306 FSHOW((stderr, "Deallocating mach port %x\n", THREAD_STRUCT_TO_EXCEPTION_PORT(th)));
307 mach_port_move_member(mach_task_self(),
308 THREAD_STRUCT_TO_EXCEPTION_PORT(th),
310 mach_port_deallocate(mach_task_self(),
311 THREAD_STRUCT_TO_EXCEPTION_PORT(th));
312 mach_port_destroy(mach_task_self(),
313 THREAD_STRUCT_TO_EXCEPTION_PORT(th));
316 schedule_thread_post_mortem(th);
317 FSHOW((stderr,"/exiting thread %lu\n", thread_self()));
321 #endif /* LISP_FEATURE_SB_THREAD */
324 free_thread_struct(struct thread *th)
326 if (th->interrupt_data)
327 os_invalidate((os_vm_address_t) th->interrupt_data,
328 (sizeof (struct interrupt_data)));
329 os_invalidate((os_vm_address_t) th->os_address,
333 /* this is called from any other thread to create the new one, and
334 * initialize all parts of it that can be initialized from another
338 static struct thread *
339 create_thread_struct(lispobj initial_function) {
340 union per_thread_data *per_thread;
341 struct thread *th=0; /* subdue gcc */
343 void *aligned_spaces=0;
344 #ifdef LISP_FEATURE_SB_THREAD
348 /* May as well allocate all the spaces at once: it saves us from
349 * having to decide what to do if only some of the allocations
350 * succeed. SPACES must be appropriately aligned, since the GC
351 * expects the control stack to start at a page boundary -- and
352 * the OS may have even more rigorous requirements. We can't rely
353 * on the alignment passed from os_validate, since that might
354 * assume the current (e.g. 4k) pagesize, while we calculate with
355 * the biggest (e.g. 64k) pagesize allowed by the ABI. */
356 spaces=os_validate(0, THREAD_STRUCT_SIZE);
359 /* Aligning up is safe as THREAD_STRUCT_SIZE has
360 * THREAD_ALIGNMENT_BYTES padding. */
361 aligned_spaces = (void *)((((unsigned long)(char *)spaces)
362 + THREAD_ALIGNMENT_BYTES-1)
363 &~(unsigned long)(THREAD_ALIGNMENT_BYTES-1));
364 per_thread=(union per_thread_data *)
366 thread_control_stack_size+
369 THREAD_STATE_LOCK_SIZE);
371 #ifdef LISP_FEATURE_SB_THREAD
372 for(i = 0; i < (dynamic_values_bytes / sizeof(lispobj)); i++)
373 per_thread->dynamic_values[i] = NO_TLS_VALUE_MARKER_WIDETAG;
374 if (all_threads == 0) {
375 if(SymbolValue(FREE_TLS_INDEX,0)==UNBOUND_MARKER_WIDETAG) {
378 /* FIXME: should be MAX_INTERRUPTS -1 ? */
379 make_fixnum(MAX_INTERRUPTS+
380 sizeof(struct thread)/sizeof(lispobj)),
382 SetSymbolValue(TLS_INDEX_LOCK,make_fixnum(0),0);
384 #define STATIC_TLS_INIT(sym,field) \
385 ((struct symbol *)(sym-OTHER_POINTER_LOWTAG))->tls_index= \
386 make_fixnum(THREAD_SLOT_OFFSET_WORDS(field))
388 STATIC_TLS_INIT(BINDING_STACK_START,binding_stack_start);
389 STATIC_TLS_INIT(BINDING_STACK_POINTER,binding_stack_pointer);
390 STATIC_TLS_INIT(CONTROL_STACK_START,control_stack_start);
391 STATIC_TLS_INIT(CONTROL_STACK_END,control_stack_end);
392 STATIC_TLS_INIT(ALIEN_STACK,alien_stack_pointer);
393 #if defined(LISP_FEATURE_X86) || defined (LISP_FEATURE_X86_64)
394 STATIC_TLS_INIT(PSEUDO_ATOMIC_BITS,pseudo_atomic_bits);
396 #undef STATIC_TLS_INIT
400 th=&per_thread->thread;
401 th->os_address = spaces;
402 th->control_stack_start = aligned_spaces;
403 th->binding_stack_start=
404 (lispobj*)((void*)th->control_stack_start+thread_control_stack_size);
405 th->control_stack_end = th->binding_stack_start;
406 th->alien_stack_start=
407 (lispobj*)((void*)th->binding_stack_start+BINDING_STACK_SIZE);
408 th->binding_stack_pointer=th->binding_stack_start;
411 #ifdef LISP_FEATURE_SB_THREAD
412 th->os_attr=malloc(sizeof(pthread_attr_t));
413 th->state_lock=(pthread_mutex_t *)((void *)th->alien_stack_start +
415 pthread_mutex_init(th->state_lock, NULL);
416 th->state_cond=(pthread_cond_t *)((void *)th->state_lock +
417 (sizeof(pthread_mutex_t)));
418 pthread_cond_init(th->state_cond, NULL);
420 th->state=STATE_RUNNING;
421 #ifdef LISP_FEATURE_STACK_GROWS_DOWNWARD_NOT_UPWARD
422 th->alien_stack_pointer=((void *)th->alien_stack_start
423 + ALIEN_STACK_SIZE-N_WORD_BYTES);
425 th->alien_stack_pointer=((void *)th->alien_stack_start);
427 #if defined(LISP_FEATURE_X86) || defined (LISP_FEATURE_X86_64)
428 th->pseudo_atomic_bits=0;
430 #ifdef LISP_FEATURE_GENCGC
431 gc_set_region_empty(&th->alloc_region);
434 #ifndef LISP_FEATURE_SB_THREAD
435 /* the tls-points-into-struct-thread trick is only good for threaded
436 * sbcl, because unithread sbcl doesn't have tls. So, we copy the
437 * appropriate values from struct thread here, and make sure that
438 * we use the appropriate SymbolValue macros to access any of the
439 * variable quantities from the C runtime. It's not quite OAOOM,
440 * it just feels like it */
441 SetSymbolValue(BINDING_STACK_START,(lispobj)th->binding_stack_start,th);
442 SetSymbolValue(CONTROL_STACK_START,(lispobj)th->control_stack_start,th);
443 SetSymbolValue(CONTROL_STACK_END,(lispobj)th->control_stack_end,th);
444 #if defined(LISP_FEATURE_X86) || defined (LISP_FEATURE_X86_64)
445 SetSymbolValue(BINDING_STACK_POINTER,(lispobj)th->binding_stack_pointer,th);
446 SetSymbolValue(ALIEN_STACK,(lispobj)th->alien_stack_pointer,th);
447 SetSymbolValue(PSEUDO_ATOMIC_BITS,(lispobj)th->pseudo_atomic_bits,th);
449 current_binding_stack_pointer=th->binding_stack_pointer;
450 current_control_stack_pointer=th->control_stack_start;
453 bind_variable(CURRENT_CATCH_BLOCK,make_fixnum(0),th);
454 bind_variable(CURRENT_UNWIND_PROTECT_BLOCK,make_fixnum(0),th);
455 bind_variable(FREE_INTERRUPT_CONTEXT_INDEX,make_fixnum(0),th);
456 bind_variable(INTERRUPT_PENDING, NIL,th);
457 bind_variable(INTERRUPTS_ENABLED,T,th);
458 bind_variable(ALLOW_WITH_INTERRUPTS,T,th);
459 bind_variable(GC_PENDING,NIL,th);
460 bind_variable(ALLOC_SIGNAL,NIL,th);
461 #ifdef LISP_FEATURE_SB_THREAD
462 bind_variable(STOP_FOR_GC_PENDING,NIL,th);
465 th->interrupt_data = (struct interrupt_data *)
466 os_validate(0,(sizeof (struct interrupt_data)));
467 if (!th->interrupt_data) {
468 free_thread_struct(th);
471 th->interrupt_data->pending_handler = 0;
472 th->interrupt_data->gc_blocked_deferrables = 0;
473 th->no_tls_value_marker=initial_function;
479 #ifdef LISP_FEATURE_MACH_EXCEPTION_HANDLER
480 mach_port_t setup_mach_exception_handling_thread();
481 kern_return_t mach_thread_init(mach_port_t thread_exception_port);
485 void create_initial_thread(lispobj initial_function) {
486 struct thread *th=create_thread_struct(initial_function);
488 #ifdef LISP_FEATURE_MACH_EXCEPTION_HANDLER
489 setup_mach_exception_handling_thread();
491 initial_thread_trampoline(th); /* no return */
492 } else lose("can't create initial thread\n");
495 #ifdef LISP_FEATURE_SB_THREAD
497 #ifndef __USE_XOPEN2K
498 extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
502 boolean create_os_thread(struct thread *th,os_thread_t *kid_tid)
504 /* The new thread inherits the restrictive signal mask set here,
505 * and enables signals again when it is set up properly. */
508 int retcode = 0, initcode;
510 FSHOW_SIGNAL((stderr,"/create_os_thread: creating new thread\n"));
512 /* Blocking deferrable signals is enough, no need to block
513 * SIG_STOP_FOR_GC because the child process is not linked onto
514 * all_threads until it's ready. */
515 thread_sigmask(SIG_BLOCK, &deferrable_sigset, &oldset);
517 #ifdef LOCK_CREATE_THREAD
518 retcode = pthread_mutex_lock(&create_thread_lock);
519 gc_assert(retcode == 0);
520 FSHOW_SIGNAL((stderr,"/create_os_thread: got lock\n"));
523 if((initcode = pthread_attr_init(th->os_attr)) ||
524 /* call_into_lisp_first_time switches the stack for the initial thread. For the
525 * others, we use this. */
526 (pthread_attr_setstack(th->os_attr,th->control_stack_start,thread_control_stack_size)) ||
527 (retcode = pthread_create
528 (kid_tid,th->os_attr,(void *(*)(void *))new_thread_trampoline,th))) {
529 FSHOW_SIGNAL((stderr, "init = %d\n", initcode));
530 FSHOW_SIGNAL((stderr, printf("pthread_create returned %d, errno %d\n", retcode, errno)));
532 perror("create_os_thread");
537 #ifdef LOCK_CREATE_THREAD
538 retcode = pthread_mutex_unlock(&create_thread_lock);
539 gc_assert(retcode == 0);
540 FSHOW_SIGNAL((stderr,"/create_os_thread: released lock\n"));
542 thread_sigmask(SIG_SETMASK,&oldset,0);
546 os_thread_t create_thread(lispobj initial_function) {
547 struct thread *th, *thread = arch_os_get_current_thread();
548 os_thread_t kid_tid = 0;
550 /* Must defend against async unwinds. */
551 if (SymbolValue(INTERRUPTS_ENABLED, thread) != NIL)
552 lose("create_thread is not safe when interrupts are enabled.\n");
554 /* Assuming that a fresh thread struct has no lisp objects in it,
555 * linking it to all_threads can be left to the thread itself
556 * without fear of gc lossage. initial_function violates this
557 * assumption and must stay pinned until the child starts up. */
558 th = create_thread_struct(initial_function);
559 if (th && !create_os_thread(th,&kid_tid)) {
560 free_thread_struct(th);
566 int signal_interrupt_thread(os_thread_t os_thread)
568 int status = pthread_kill(os_thread, SIG_INTERRUPT_THREAD);
569 FSHOW_SIGNAL((stderr,"/signal_interrupt_thread: %lu\n", os_thread));
572 } else if (status == ESRCH) {
575 lose("cannot send SIG_INTERRUPT_THREAD to thread=%lu: %d, %s\n",
576 os_thread, status, strerror(status));
580 /* stopping the world is a two-stage process. From this thread we signal
581 * all the others with SIG_STOP_FOR_GC. The handler for this signal does
582 * the usual pseudo-atomic checks (we don't want to stop a thread while
583 * it's in the middle of allocation) then waits for another SIG_STOP_FOR_GC.
586 /* To avoid deadlocks when gc stops the world all clients of each
587 * mutex must enable or disable SIG_STOP_FOR_GC for the duration of
588 * holding the lock, but they must agree on which. */
589 void gc_stop_the_world()
591 struct thread *p,*th=arch_os_get_current_thread();
592 int status, lock_ret;
593 #ifdef LOCK_CREATE_THREAD
594 /* KLUDGE: Stopping the thread during pthread_create() causes deadlock
596 FSHOW_SIGNAL((stderr,"/gc_stop_the_world:waiting on create_thread_lock\n"));
597 lock_ret = pthread_mutex_lock(&create_thread_lock);
598 gc_assert(lock_ret == 0);
599 FSHOW_SIGNAL((stderr,"/gc_stop_the_world:got create_thread_lock\n"));
601 FSHOW_SIGNAL((stderr,"/gc_stop_the_world:waiting on lock\n"));
602 /* keep threads from starting while the world is stopped. */
603 lock_ret = pthread_mutex_lock(&all_threads_lock); \
604 gc_assert(lock_ret == 0);
606 FSHOW_SIGNAL((stderr,"/gc_stop_the_world:got lock\n"));
607 /* stop all other threads by sending them SIG_STOP_FOR_GC */
608 for(p=all_threads; p; p=p->next) {
609 gc_assert(p->os_thread != 0);
610 FSHOW_SIGNAL((stderr,"/gc_stop_the_world: thread=%lu, state=%x\n",
611 p->os_thread, thread_state(p)));
612 if((p!=th) && ((thread_state(p)==STATE_RUNNING))) {
613 FSHOW_SIGNAL((stderr,"/gc_stop_the_world: suspending thread %lu\n",
615 status=pthread_kill(p->os_thread,SIG_STOP_FOR_GC);
617 /* This thread has exited. */
618 gc_assert(thread_state(p)==STATE_DEAD);
620 lose("cannot send suspend thread=%lu: %d, %s\n",
621 p->os_thread,status,strerror(status));
625 FSHOW_SIGNAL((stderr,"/gc_stop_the_world:signals sent\n"));
626 for(p=all_threads;p;p=p->next) {
630 "/gc_stop_the_world: waiting for thread=%lu: state=%x\n",
631 p->os_thread, thread_state(p)));
632 wait_for_thread_state_change(p, STATE_RUNNING);
633 if (p->state == STATE_RUNNING)
634 lose("/gc_stop_the_world: unexpected state");
637 FSHOW_SIGNAL((stderr,"/gc_stop_the_world:end\n"));
640 void gc_start_the_world()
642 struct thread *p,*th=arch_os_get_current_thread();
644 /* if a resumed thread creates a new thread before we're done with
645 * this loop, the new thread will get consed on the front of
646 * all_threads, but it won't have been stopped so won't need
648 FSHOW_SIGNAL((stderr,"/gc_start_the_world:begin\n"));
649 for(p=all_threads;p;p=p->next) {
650 gc_assert(p->os_thread!=0);
652 lispobj state = thread_state(p);
653 if (state != STATE_DEAD) {
654 if(state != STATE_SUSPENDED) {
655 lose("gc_start_the_world: wrong thread state is %d\n",
656 fixnum_value(state));
658 FSHOW_SIGNAL((stderr, "/gc_start_the_world: resuming %lu\n",
660 set_thread_state(p, STATE_RUNNING);
665 lock_ret = pthread_mutex_unlock(&all_threads_lock);
666 gc_assert(lock_ret == 0);
667 #ifdef LOCK_CREATE_THREAD
668 lock_ret = pthread_mutex_unlock(&create_thread_lock);
669 gc_assert(lock_ret == 0);
672 FSHOW_SIGNAL((stderr,"/gc_start_the_world:end\n"));
679 #ifdef LISP_FEATURE_SB_THREAD
680 return sched_yield();