Browse Source
If cancel() was called before the first lock was acquired in run(), then cancel() would return immediately and run() would continue as if it was not canceled (which could cause segfaults). To avoid the problem, always set the "canceled" flag on cancel, so that any future execution of run() will return immediately. Note: we could alternatively track the "finished" state, and wait until the task is finished on cancel(). However, if run() may not start immediately (if the thread pool is full), this strategy would cause to block on cancel() until run() is actually executed, which is unnecessary. Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>pull/117/head
committed by
Alexandre Janniaux
1 changed files with 1 additions and 1 deletions
Loading…
Reference in new issue