|
From: Matthieu C. <mat...@pa...> - 2007-11-23 09:40:08
|
Hi,
in valgrind svn, helgrind issue some "sem_wait succeeded on semaphore without
prior sem_post".
But what about a semaphore that is initialized with a "value > 0".
So the comment in the code [1] seems wrong.
Matthieu
[1]
/* Hmm. How can a wait on 'sem' succeed if nobody posted to
it? If this happened it would surely be a bug in the
threads library. */
|
|
From: Julian S. <js...@ac...> - 2007-11-23 11:58:00
|
Good point. I guess it should check only that sem_wait cannot succeed on a semaphore whose value is zero. But Helgrind does not track the value of the semaphore, so this check should just disappear. Can you send a simple test program? J On Friday 23 November 2007 10:39, Matthieu CASTET wrote: > Hi, > > in valgrind svn, helgrind issue some "sem_wait succeeded on semaphore > without prior sem_post". > But what about a semaphore that is initialized with a "value > 0". > > So the comment in the code [1] seems wrong. > > > Matthieu > > [1] > /* Hmm. How can a wait on 'sem' succeed if nobody posted to > it? If this happened it would surely be a bug in the > threads library. */ > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users |
|
From: Matthieu C. <mat...@pa...> - 2007-11-23 12:11:23
|
Julian Seward <jseward <at> acm.org> writes: > > > Good point. I guess it should check only that sem_wait cannot > succeed on a semaphore whose value is zero. But Helgrind does > not track the value of the semaphore, so this check should > just disappear. > > Can you send a simple test program? > #include <semaphore.h> int main() { sem_t sem; sem_init(&sem, 0, 1); sem_wait(&sem); return 0; } |
|
From: Julian S. <js...@ac...> - 2007-11-30 11:12:19
|
Fixed (svn r7253). Semphores with nonzero initial values should be handled correctly now. J On Friday 23 November 2007 13:10, Matthieu CASTET wrote: > Julian Seward <jseward <at> acm.org> writes: > > Good point. I guess it should check only that sem_wait cannot > > succeed on a semaphore whose value is zero. But Helgrind does > > not track the value of the semaphore, so this check should > > just disappear. > > > > Can you send a simple test program? > > #include <semaphore.h> > > int main() > { > sem_t sem; > > sem_init(&sem, 0, 1); > sem_wait(&sem); > return 0; > } > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users |