Re: GModule build fixes



Hi Dan,

> > >         * thread-test fix to use g_thread_yield() to yield, rather than
> > >           g_usleep
> > 
> > Can you explain this one a bit more?
> 
> g_usleep "pauses the program for the given number of microseconds".
> g_thread_yield "give[s] way to other threads waiting to be scheduled".
> All of the cases in thread-test that use g_usleep are using it to let
> other threads get processor time, which I'm guessing works on Linux
> because of the way that threads are just processes. But in general,
> g_usleep() is going to pause the whole program, and so thread-test.c on
> my machine almost always died with:

Actually g_thread_sleep should only make the current thread sleep. If
that's not the case, it's clearly a bug.

> (process:15561): ** ERROR **: file thread-test.c: line 13
> (test_g_mutex_thread): assertion failed: (g_mutex_trylock
> (test_g_mutex_mutex) == FALSE)
> aborting...

Aha, that of course can happen with (very) bad timing. It means that the
started thread wont run for a second. I suspect nanosleep isn't MT-safe
on FreeBSD. It is on linux and Solaris. Can you try to recompile GLib
(actually only gtimer.c) without '#define HAVE_NANOSLEEP 1' in config.h.
Does thread-test work then?

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]