Christoph Bartoschek <bartosc...@or.uni-bonn.de> writes:
> Am Donnerstag, 5. Februar 2009 schrieb Julian Seward:
> > On Thursday 05 February 2009, Christoph Bartoschek wrote:
> > > Hi,
> > >
> > > today I had to learn that the attached program is incorrect. It is not
> > > allowed to destroy the barrier while not all threads have left the
> > > pthread_barrier_wait() call.
> > >
> > > Unfortunately neither DRD nor Helgrind warn about this error. Could you
> > > please improve the tools to detect such errors?
> >
> > Um, where is the bug in this program?  To me it looks OK: the barrier
> > is not destroyed until after both parent and child have passed it.
> >
> 
> For me this also looked ok till now. But the standard seems not to guarantee 
> that this works.
> 
> I have asked about this in comp.programming.threads:
> 
> http://groups.google.com/group/comp.programming.threads/browse_thread/thread/
> 4f65535d6192aa50/a5f4bf1e3b437c4d?lnk=st&q=#a5f4bf1e3b437c4d
> 
> My explanation is that the threads need still access to the barrier after 
> being woken up from the wait.
> 
> When the last thread reaches the barrier all waiting threads are woken up but
> they are not yet finished with pthread_barrier_wait(). When the first thread 
> leaving pthread_barrier_wait() destroys the barrier, then the other threads 
> cannot perform their final tasks in pthread_barrier_wait().

I'm getting a bit off topic, but ..

Perhaps I'm just not understanding the linked-to discussion, but given
this interpretation -- how could one ever delete a barrier?

It sounds like the only safe way to destroy the barrier is if you've
joined every thread which could have possibly used it.  Given that
constraint, I'm not sure how real world software could reasonably deal
with this.

So is the idea essentially that we might as well forget about
destroying barriers?  What am I missing?

-tom

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to