diff options
author | ivmai <ivmai> | 2011-04-26 21:09:41 +0000 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-07-26 21:06:58 +0400 |
commit | 55c48e217fac1f752c19c36895f634beb2ba0dae (patch) | |
tree | 4135804752f4633935e37effe4ddd6e7a953325b /tests | |
parent | 782c5a03ff94e2e2c4ec90ab40e6302a083e8abf (diff) | |
download | bdwgc-55c48e217fac1f752c19c36895f634beb2ba0dae.tar.gz |
2011-04-26 Ivan Maidanski <ivmai@mail.ru>
* .cvsignore (initsecondarythread, test_cpp): Add.
* os_dep.c (GC_linux_stack_base): Rename to
GC_linux_main_stack_base.
* os_dep.c (GC_freebsd_stack_base): Rename to
GC_freebsd_main_stack_base; adjust error message.
* pthread_stop_world.c (GC_stop_init): Use GC_SEM_INIT_PSHARED
as an argument for sem_init().
* pthread_support.c (pthread_create): Ditto.
* pthread_support.c (pthread_create): Abort in case sem_init()
fails.
* include/private/gc_priv.h (GC_SEM_INIT_PSHARED): Define.
* tests/initsecondarythread.c: Include gcconfig.h; call GC_INIT
from main() if it should be done from the primordial thread only.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/initsecondarythread.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tests/initsecondarythread.c b/tests/initsecondarythread.c index feed5604..f89252e2 100644 --- a/tests/initsecondarythread.c +++ b/tests/initsecondarythread.c @@ -28,16 +28,28 @@ static void *thread(void *arg) { - GC_INIT (); - GC_MALLOC (123); - GC_MALLOC (12345); - return NULL; + GC_INIT(); + GC_MALLOC(123); + GC_MALLOC(12345); + return NULL; } +#include "private/gcconfig.h" + int main(void) { - pthread_t t; - pthread_create (&t, NULL, thread, NULL); - pthread_join (t, NULL); - return 0; + pthread_t t; +# if !(defined(BEOS) || defined(MSWIN32) || defined(MSWINCE) \ + || defined(CYGWIN32) || defined(GC_OPENBSD_THREADS) \ + || (defined(DARWIN) && !defined(NO_PTHREAD_GET_STACKADDR_NP)) \ + || (defined(LINUX) && !defined(NACL)) \ + || (defined(GC_SOLARIS_THREADS) && !defined(_STRICT_STDC)) \ + || (!defined(STACKBOTTOM) && (defined(HEURISTIC1) \ + || (!defined(LINUX_STACKBOTTOM) && !defined(FREEBSD_STACKBOTTOM))))) + /* GC_INIT() must be called from main thread only. */ + GC_INIT(); +# endif + pthread_create (&t, NULL, thread, NULL); + pthread_join (t, NULL); + return 0; } |