[cpp-threads] pthreads cancellation

Kevlin Henney kevlin at curbralan.com
Mon May 2 16:57:01 BST 2005


In message <427646FE.4040607 at cs.oswego.edu>, Doug Lea <dl at cs.oswego.edu>
writes
>Kevlin Henney wrote:
>
>>  What was the specific issue you had in mind? I had envisaged that
>>cancellation is something that is carried out through joiners (or the
>>currently opaque thread identity returned from threadof).
>>  Kevlin
>
>There are two sorts of use cases here:
>
>1. You created the task but now want to kill it.
>(example: someone hits a cancel button.)
>
>2. You originally wanted to wait for it but now longer want to.
>(example: parallel database lookups. Kill others after
>the first returns.)
>
>Can you show what these might look like under your proposal?

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);

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