[dmd-concurrency] draft 5

Andrei Alexandrescu andrei at erdani.com
Tue Jan 19 23:05:39 PST 2010



Sean Kelly wrote:
> On Jan 19, 2010, at 10:44 PM, Kevin Bealer wrote:
> 
>>
>> On Wed, Jan 20, 2010 at 1:39 AM, Sean Kelly <sean at invisibleduck.org> wrote:
>> void fnB() {
>>    // do something that takes a while
>> }
>> void fnA() {
>> auto tid = 
>>    spawn( &fnB );
>> tid.wait();
>> }
>>
>> void main() {
>>    auto tid = spawn( &fnA );
>>    tid.wait();
>> }
> 
> So we've created a dependency tree where a thread that spawns other threads must wait for them all to complete before terminating.  I suppose I just don't understand why it's such a bad thing for the main thread to terminate early that we should go to such lengths.


I guess we need to go to equally long lengths to support graceful 
termination after main does terminate :o).

Andrei


More information about the dmd-concurrency mailing list