diff options
author | Sebastian Wilhelmi <wilhelmi@ira.uka.de> | 1999-01-07 16:17:42 +0000 |
---|---|---|
committer | Sebastian Wilhelmi <wilhelmi@src.gnome.org> | 1999-01-07 16:17:42 +0000 |
commit | 81f8d0bb10c945c459b2a8063bf70039be113771 (patch) | |
tree | ca4b4ce4df360d0a728e542beeb92aa455e3f712 /gthread | |
parent | 9200f444626fd7b814c30f351f872a11e0d9a64c (diff) | |
download | glib-81f8d0bb10c945c459b2a8063bf70039be113771.tar.gz |
Here we must replace getpwuid by getpwuid_r, but as I do not know how for
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
getpwuid_r, but as I do not know how for now, I just made a FIXME
note ;-)
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
thread safe.
* configure.in: We do not need to check for broken solaris mutex
intitializer any longer. Provide a macro to show the used thread
implementation. Not nice, but this is needed until thread support
is completed here inside glib.
* gthread/testgthread.c: conditionally compile according to the
G_THREADS_IMPL_??? macros.
(test_private_func): use rand_r instead of rand to make it
thread safe.
Diffstat (limited to 'gthread')
-rw-r--r-- | gthread/ChangeLog | 7 | ||||
-rw-r--r-- | gthread/testgthread.c | 27 |
2 files changed, 25 insertions, 9 deletions
diff --git a/gthread/ChangeLog b/gthread/ChangeLog index 0a20f089b..939ae56c5 100644 --- a/gthread/ChangeLog +++ b/gthread/ChangeLog @@ -1,3 +1,10 @@ +1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de> + + * testgthread.c: conditionally compile according to the + G_THREADS_IMPL_??? macros. + (test_private_func): use rand_r instead of rand to make it + thread safe. + 1998-12-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * testgthread.c (new_thread): As a joinable thread seems to be the diff --git a/gthread/testgthread.c b/gthread/testgthread.c index c2149d461..8fabc5add 100644 --- a/gthread/testgthread.c +++ b/gthread/testgthread.c @@ -40,12 +40,11 @@ test_mutexes (void) } } -#if defined(NSPR) /* we are using nspr threads */ -/* this option must be specified by hand during compile of - testgthread. also note, that you have to link with whatever library - nspr is building upon, it might otherwise (as on solaris) lead to - run time failure, as the mutex functions are defined in libc, but - as noops, that will make some nspr assertions fail. */ +#if defined(G_THREADS_IMPL_NSPR) +#warning "note, that you have to link with whatever library" +#warning "nspr is building upon, it might otherwise (as on solaris) lead to" +#warning "run time failure, as the mutex functions are defined in libc, but" +#warning "as noops, that will make some nspr assertions fail." #include <prthread.h> gpointer @@ -59,7 +58,8 @@ new_thread (GHookFunc func, gpointer data) #define join_thread(thread) PR_JoinThread (thread) #define self_thread() PR_GetCurrentThread () -#elif defined(DEFAULTMUTEX) /* we are using solaris threads */ +#elif defined(G_THREADS_IMPL_SOLARIS) +#include <thread.h> gpointer new_thread (GHookFunc func, gpointer data) @@ -72,7 +72,9 @@ new_thread (GHookFunc func, gpointer data) thr_join ((thread_t)GPOINTER_TO_UINT (thread), NULL, NULL) #define self_thread() GUINT_TO_POINTER (thr_self ()) -#elif defined(PTHREAD_MUTEX_INITIALIZER) /* we are using posix threads */ +#elif defined(G_THREADS_IMPL_POSIX) +#include <pthread.h> + gpointer new_thread(GHookFunc func, gpointer data) { @@ -151,10 +153,17 @@ void test_private_func (void *data) { guint i = 0; + static unsigned int seed = 0; + if (!seed) + { + GTimeVal now; + g_get_current_time (&now); + seed = now.tv_usec; + } wait_thread (1); while (i < TEST_PRIVATE_ROUNDS) { - guint random_value = rand () % 10000; + guint random_value = rand_r (&seed) % 10000; guint *data = g_static_private_get (&private_key); if (!data) { |