> COND is accessed before cond_signal() in child thread

yes

> and after cond_wait() in parent thread.

no:

    while (COND != 1) {
      fprintf(stderr, "Wait: COND: %d\n", COND);
      pthread_cond_wait(&CV, &MU);
    }

If the parent only accessed COND after cond_wait, then Helgrind would
not complain, as then it would understand that "exclusive ownership" is
transferred from child to parent by the signal/wait pair.  However, both
parent and child access it before the signal/wait pair, COND is marked
as being in shared ownership, and the above doesn't apply.

> >> If you change the order of these two lines, to
>
> Sure. But thread_join is not what is usually done in presence of thread
> pools...
> Threads tend to live forever.
> This program is just a short reproducer.

Yes.  I suspect what you are seeing is a problem to do with memory
recycling.  See Helgrind manual Sec 7.5 point 2.

Can you send a slightly bigger reproducer, which has the child thread
doing a few units of work that are passed to it from the parent thread?

J

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to