2011-04-02 Jon TURNEY <jon.turney@dronecode.org.uk>

* thread.cc (semaphore::init): We cannot reliably infer anything from
        the existing contents of sem, so merely warn rather than return EBUSY
        if it looks like we are reinitialising a semaphore.
This commit is contained in:
Jon TURNEY 2011-04-19 18:51:20 +00:00
parent ed240047f2
commit 11629685f1
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2011-04-02 Jon TURNEY <jon.turney@dronecode.org.uk>
* thread.cc (semaphore::init): We cannot reliably infer anything from
the existing contents of sem, so merely warn rather than return EBUSY
if it looks like we are reinitialising a semaphore.
2011-04-19 Corinna Vinschen <corinna@vinschen.de> 2011-04-19 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (GetConsoleWindow): Drop. * autoload.cc (GetConsoleWindow): Drop.

View File

@ -3209,11 +3209,14 @@ semaphore::_terminate ()
int int
semaphore::init (sem_t *sem, int pshared, unsigned int value) semaphore::init (sem_t *sem, int pshared, unsigned int value)
{ {
/* opengroup calls this undefined */ /*
We can't tell the difference between reinitialising an
existing semaphore and initialising a semaphore who's
contents happen to be a valid pointer
*/
if (is_good_object (sem)) if (is_good_object (sem))
{ {
set_errno(EBUSY); paranoid_printf ("potential attempt to reinitialise a semaphore");
return -1;
} }
if (value > SEM_VALUE_MAX) if (value > SEM_VALUE_MAX)