Re: GModule build fixes



On Mon, 2001-11-26 at 09:54, Sebastian Wilhelmi wrote:
> 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".
...
> Actually g_thread_sleep should only make the current thread sleep. If
> that's not the case, it's clearly a bug.

(You mean "g_usleep", not "g_thread_sleep", which doesn't exist.)

OK, looking at the implementation, it's obviously aiming for the
behavior you describe, so the docs are wrong. (The "pauses the program"
quote above comes straight from gdate.sgml.)

> 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.

*Thwack*. I said "NetBSD", not "FreeBSD". :-)

Anyway, you're right. I'm using GNU Pth, which doesn't wrap nanosleep.
But I think it's reasonable for glib to assume that if you have both
threads and nanosleep that you have threaded nanosleep, so this is pth's
bug, not glib's.

-- Dan



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