[cpp-threads] pthreads cancellation

Kevlin Henney kevlin at curbralan.com
Tue May 3 07:59:21 BST 2005


In message <42765438.1050004 at cs.oswego.edu>, Doug Lea <dl at cs.oswego.edu>
writes
>>  Given
>>          joiner<void> synch = thread(task);
>>  Then either cancellation is expressed as a member of the joiner:
>>          synch.cancel();
>>  Or it can be expressed as a non-member:
>>          cancel(synch);
>
>OK. Good (especially the former). And you'd also have isDone,
>isCancelled methods?

Yes, with the former expressed as an implicit Boolean conversion, ie

        if(synch)
                ... // we're done, do something with result
        else
                ... // still waiting, do something else

>In which case I now see how the classes
>are C++ analogs of Java Executors+Futures (so I like them :-)

Great :-) Yes, I have always considered them futures; it is only matters
of syntax and terminology that really differ.

Kevlin
-- 
____________________________________________________________

  Kevlin Henney                   phone:  +44 117 942 2990
  mailto:kevlin at curbralan.com     mobile: +44 7801 073 508
  http://www.curbralan.com        fax:    +44 870 052 2289
  Curbralan: Consultancy + Training + Development + Review
____________________________________________________________




More information about the cpp-threads mailing list