summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorivmai <ivmai>2011-05-13 17:05:20 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:59 +0200
commit86d9a59dbc7763b156932dbc961112290b1d74d3 (patch)
tree9b33737ee16749ae0697b0f7da53c9d741c02900 /tests
parent8d76348edc08b652a4357021756862ba27881371 (diff)
2011-05-13 Ivan Maidanski <ivmai@mail.ru>
* tests/threadkey_test.c (key_once, main): Work around for Solaris PTHREAD_ONCE_INIT. * tests/threadkey_test.c (LIMIT): Use smaller value for Solaris.
Diffstat (limited to 'tests')
-rw-r--r--tests/threadkey_test.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/tests/threadkey_test.c b/tests/threadkey_test.c
index 5b6a516..5bf18de 100644
--- a/tests/threadkey_test.c
+++ b/tests/threadkey_test.c
@@ -10,7 +10,12 @@
#include <pthread.h>
pthread_key_t key;
-pthread_once_t key_once = PTHREAD_ONCE_INIT;
+
+#ifdef GC_SOLARIS_THREADS
+ /* pthread_once_t key_once = { PTHREAD_ONCE_INIT }; */
+#else
+ pthread_once_t key_once = PTHREAD_ONCE_INIT;
+#endif
void * entry (void *arg)
{
@@ -41,7 +46,11 @@ void make_key (void)
}
#ifndef LIMIT
-# define LIMIT 50
+# ifdef GC_SOLARIS_THREADS
+# define LIMIT 40
+# else
+# define LIMIT 50
+# endif
#endif
int main (void)
@@ -49,13 +58,14 @@ int main (void)
int i;
GC_INIT ();
- pthread_once (&key_once, make_key);
-
- for (i = 0; i < LIMIT; i++)
- {
- pthread_t t;
- GC_pthread_create (&t, NULL, entry, NULL);
- }
-
+# ifdef GC_SOLARIS_THREADS
+ pthread_key_create (&key, on_thread_exit);
+# else
+ pthread_once (&key_once, make_key);
+# endif
+ for (i = 0; i < LIMIT; i++) {
+ pthread_t t;
+ GC_pthread_create (&t, NULL, entry, NULL);
+ }
return 0;
}