[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ITS#3950

At 07:59 PM 1/5/2006, Howard Chu wrote:
>Kurt D. Zeilenga wrote:
>>At 05:42 PM 1/5/2006, Kurt D. Zeilenga wrote:
>>>At 04:00 PM 1/5/2006, Howard Chu wrote:
>>>>I reworked most of the yield() calls in daemon.c, and those changes are in RE23. However, the BDB library itself makes yield() calls as well, which I ignored. It seems we should apply the patch in ITS#3950 after all.       
>>>We likely need to do so conditionally.
>>>On FreeBSD 4, using select(2) here causes test008 to run forever
>>>(or, at least very much longer than normal).
>>replacing the select(2) call with a usleep(2) call with argument
>>of zero (0) works much better on FreeBSD4.

nanosleep(2) also works fine on FreeBSD4.

The man pages says usleep(3 not 2) calls nanosleep(2), so
calling nanosleep(2) directly would generally be preferred.

>Strangely enough, my SuSE manpage for usleep(1) says:
> If 0 microseconds are specified sched_yield(2) is called.
>No mention of it for usleep(3) so perhaps it's only a peculiarity of the command line tool.
>I suppose we could devise some kind of test that uses two processes, one that spins eating CPU cycles, and another that spawns one thread that does a yield, while the main thread does a computation. If the yield causes the entire process to lose the CPU, the main thread's computation will be impeded. But it may be better to just test $build_os for now.

For now, yes.

> -- Howard Chu
> Chief Architect, Symas Corp.  http://www.symas.com
> Director, Highland Sun        http://highlandsun.com/hyc
> OpenLDAP Core Team            http://www.openldap.org/project/