bug-gnulib
[Top][All Lists]
Advanced

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

Re: bugs in test-lock


From: Bruno Haible
Subject: Re: bugs in test-lock
Date: Fri, 06 Jan 2017 14:45:30 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Torvald Riegel wrote:
> > Are you suggesting that the pthread_yield manual page is wrong? Or that
> > some warning should be added to it? I'm sure Michael Kerrisk will accept 
> > inputs.
> 
> I don't think it's necessarily wrong, but if there's no actual run queue
> because you have more or the same number of cores (or HW threads)
> available than what the number of runnable OS threads is, then this
> won't push through a FIFO run queue and thus won't order them one after
> the other.

OK, I've forwarded your statement to Michael Kerrisk so that he may improve
the man page.

> Regarding the patch, why don't you just use the semaphore directly, but
> wrap it as an atomic_int (which it is not)?

1) I did so because of portability issues:
     - GNU Pth (one of the platforms supported by the gnulib module) does not
       have semaphores.
     - I didn't want to dig into the semaphores API of Windows at this point.
     - Testing among POSIX platforms is incomplete, and I may need to revert
       back to mutexes on some (weird) platform.
2) In 10 years or so, we may wish to replace this 'struct atomic_int' by
   something provided by <stdatomic.h>.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]