From bd86ef8b64d8a1db388ee8963c54af411e8a226d Mon Sep 17 00:00:00 2001 From: ivmai Date: Sun, 20 Feb 2011 10:54:32 +0000 Subject: 2011-02-20 Ivan Maidanski (mostly really Elijah Taylor) * gc_dlopen.c: Empty unit for NaCl. * os_dep.c: Include fcntl.h for NaCl. * os_dep.c (GC_get_main_stack_base): Ignore USE_GET_STACKBASE_FOR_MAIN macro for NaCl. * os_dep.c (GC_get_stack_base): Return GC_UNIMPLEMENTED for NaCl. * os_dep.c (GC_remap): Use mmap (instead of mprotect) for NaCl. * pthread_start.c (GC_inner_start_routine): Don't invoke pthread_cleanup_push/pop for NaCl. * pthread_stop_world.c (GC_nacl_num_gc_threads, GC_nacl_thread_idx, GC_nacl_park_threads_now, GC_nacl_thread_parker, GC_nacl_gc_thread_self, GC_nacl_thread_parked, GC_nacl_thread_used, GC_nacl_thread_parking_inited, GC_nacl_thread_alloc_lock): New variable (fo NaCl only). * pthread_stop_world.c (GC_suspend_handler): Reformat the code. * pthread_stop_world.c (GC_remove_allowed_signals, suspend_handler_mask, GC_stop_count, GC_world_is_stopped, GC_retry_signals, SIG_THR_RESTART, GC_suspend_ack_sem, GC_restart_ack_sem, GC_suspend_handler_inner, GC_suspend_handler, GC_restart_handler): Don't define for NaCl. * pthread_support.c (GC_get_nprocs): Ditto. * include/private/gc_priv.h (SIG_SUSPEND): Ditto. * include/private/gcconfig.h (LINUX): Ditto. * pthread_stop_world.c (GC_push_all_stacks): Push register storage for NaCl. * pthread_stop_world.c (GC_suspend_all, GC_stop_world, GC_start_world): Implement for NaCl. * pthread_stop_world.c (GC_stop_world): Don't define unused "i" local variable for OpenBSD (and NaCl). * pthread_stop_world.c (NACL_STORE_REGS): New macro definition for NaCl. * pthread_stop_world.c (nacl_pre_syscall_hook, __nacl_suspend_thread_if_needed, nacl_post_syscall_hook, GC_nacl_initialize_gc_thread, GC_nacl_shutdown_gc_thread): New function (for NaCl only). * pthread_stop_world.c (GC_stop_init): Empty for NaCl. * pthread_support.c (pthread_cancel, pthread_sigmask): Don't redirect for NaCl. * include/gc_pthread_redirects.h (pthread_cancel, pthread_sigmask): Ditto. * pthread_support.c (GC_nacl_initialize_gc_thread, GC_nacl_shutdown_gc_thread): New internal prototype (NaCl only). * pthread_support.c (GC_new_thread, GC_delete_thread): Initialize and shutdown thread for NaCl. * pthread_support.c (GC_thr_init): Call sysconf for NaCl. * pthread_support.c (GC_pthread_exit): Call GC_thread_exit_proc for NaCl. * include/gc.h: Don't include features.h for NaCl. * include/gc_pthread_redirects.h (GC_PTHREAD_CONST): New macro. * include/gc_pthread_redirects.h (GC_pthread_create): Use GC_PTHREAD_CONST instead of const. * win32_threads.c (GC_pthread_create): Ditto. * pthread_support.c (GC_pthread_create_t, GC_pthread_create, pthread_create): Ditto. * include/private/gcconfig.h (NACL): Recognize NaCl. * include/private/gcconfig.h (GC_LINUX_THREADS): Valid for NaCl. * include/private/pthread_stop_world.h (thread_stop_info): Add reg_storage member; define NACL_GC_REG_STORAGE_SIZE macro (for NaCl only). * include/private/pthread_support.h (GC_nacl_gc_thread_self): Declare internal variable (for NaCl only). --- pthread_start.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'pthread_start.c') diff --git a/pthread_start.c b/pthread_start.c index a6e1f72d..cbe5a857 100644 --- a/pthread_start.c +++ b/pthread_start.c @@ -55,15 +55,19 @@ void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb, void *arg) void * result; GC_thread me = GC_start_rtn_prepare_thread(&start, &start_arg, sb, arg); - pthread_cleanup_push(GC_thread_exit_proc, 0); +# ifndef NACL + pthread_cleanup_push(GC_thread_exit_proc, 0); +# endif result = (*start)(start_arg); # ifdef DEBUG_THREADS GC_printf("Finishing thread 0x%x\n", (unsigned)pthread_self()); # endif me -> status = result; - pthread_cleanup_pop(1); - /* Cleanup acquires lock, ensuring that we can't exit while */ - /* a collection that thinks we're alive is trying to stop us. */ +# ifndef NACL + pthread_cleanup_pop(1); + /* Cleanup acquires lock, ensuring that we can't exit while */ + /* a collection that thinks we're alive is trying to stop us. */ +# endif return result; } -- cgit v1.2.1