Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] thread_group::join_any
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-06-10 18:26:59


----- Original Message -----
From: "Gaetano Mendola" <mendola_at_[hidden]>
To: <threads-devel_at_[hidden]>
Sent: Thursday, June 10, 2010 10:57 PM
Subject: Re: [Threads-devel] thread_group::join_any

>
> On 01/06/2010 18.15, vicente.botet wrote:
>> The problem with your implementation is that use polling to joing a thread.
>>
>> I think that join_any could be implemented by adding a condition that will be notified by each one of the threads.
>> Even if this could seam intrusive we can define thread_group class that creates the threads and wraps the call
> > to the user function with the condition.
>
> So what you propose is to encapsulate the original thead into a class
> with the operator()() getting:
>
> -) a reference to a condition from the thread_group (theCondition)
> -) a reference to a mutex from the thread_group (theMutex)
> -) a reference to the "threadfunction" being added (theOriginalFunction)
>
> register as "threadfunction" this wrapper with the operator()()
> implemented something like this:
>
<snip>

> I think it could work.

Yes, someting like that.

Vicente


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk