summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-05-13 15:05:22 +0000
committerIvan Maidanski <ivmai@mail.ru>2012-11-14 13:49:55 +0400
commitc30b3749a27a58760850d47b347c1c06d206b483 (patch)
treeba3211711c3158d4c39a30d5aa996fa5bd5d074e
parentbdefd5933477b297c44bf19abe17a3cabaa362ec (diff)
downloadbdwgc-c30b3749a27a58760850d47b347c1c06d206b483.tar.gz
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. --HG-- branch : bdwgc
-rw-r--r--ChangeLog6
-rwxr-xr-xtests/threadkey_test.c30
2 files changed, 26 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d0d3376..a5ffb560 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
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.
+
+2011-05-13 Ivan Maidanski <ivmai@mail.ru>
+
* dyn_load.c (GC_FirstDLOpenedLinkMap): Remove unused "r" local
variable.
* pthread_support.c (GC_unregister_my_thread_inner): Revert back
diff --git a/tests/threadkey_test.c b/tests/threadkey_test.c
index 5b6a5167..5bf18de0 100755
--- 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;
}