Re: [Algorithms] General purpose task parallel threading approach
Brought to you by:
vexxed72
|
From: Jon W. <jw...@gm...> - 2009-04-06 16:47:52
|
asy...@gm... wrote: > Where do you get a deadlock from ? If a specific operation is not cancellable, and waits for completion no matter what, then that means that cancelling the fiber will have to wait for that operation to complete. If the operation in turn needs another task to complete, which may be later in the work queue, or require locks/resources currently held by the fiber doing the cancellation, then you have a deadlock. In general, non-cancellable operations are bad (similar to non-signal-breakable syscalls in UNIX). The right thing to do is to make any operation cancellable, and we've found that the best way to make sure nobody does the wrong thing is to simply throw an exception out of the yield call when an operation is cancelled. Proper use of smart pointers and RAII will then take care of the unwind semantics. That being said, blocking is still rare in game loops; we use all of this only for the transactional application server back-end. Sincerely, jw |