[Boost-users] Semaphores vs. condition_variable with valgrind/helgrind

47 views
Skip to first unread message

Chris Stankevitz

unread,
Aug 11, 2012, 9:50:38 PM8/11/12
to Boost...@lists.boost.org
Hello,

Does boost provide a semaphore (aka an implementation of pthreads's
sem_post and sem_wait)? I know boost provides a condition_variable.
However, I would prefer a true POSIX semaphore. I created a
"semaphore" using internally boost condition variables.

Valgrind's tool "helgrind" is reporting false positives on my
implentation of a semaphore due to my use of condition_variables.
According to http://www.valgrind.org/docs/manual/hg-manual.htm

Avoid POSIX condition variables. If you can, use POSIX semaphores
(sem_t, sem_post, sem_wait) to do inter-thread event signalling.

Thank you,

Chris
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Chris Stankevitz

unread,
Aug 11, 2012, 10:07:02 PM8/11/12
to Boost...@lists.boost.org
On Sat, Aug 11, 2012 at 6:50 PM, Chris Stankevitz
<chrisst...@gmail.com> wrote:
> Valgrind's tool "helgrind" is reporting false positives on my
> implentation of a semaphore due to my use of condition_variables.

This is not true. The "positives" that helgrind are reporting are not
from boost condition variables. I'll post here if I find out
something interesting about boost and helgrind.

Chris Stankevitz

unread,
Aug 11, 2012, 10:32:51 PM8/11/12
to Boost...@lists.boost.org
On Sat, Aug 11, 2012 at 7:07 PM, Chris Stankevitz
<chrisst...@gmail.com> wrote:
> I'll post here if I find out
> something interesting about boost and helgrind.

The following program triggers what must be false positives from helgrind:

//===
#include <boost/thread.hpp>

void f()
{
}

int main()
{
boost::thread Thread(f);

Thread.join();

return 0;
}
//===

The errors are attached.

Chris
out.txt
Reply all
Reply to author
Forward
0 new messages