canonizer/libgpuvm — Issue #13: non-racing thread stopping
Author: canonizer
Created: 2011-11-02 20:38:11+00:00
State: open

make thread stopping non-racing. Currently, stopping is implemented with a single semaphore; for a thread to stop, it is sent a signal. In the signal handler, the thread waits on a semaphore, which is raised when the threads can be resumed. However, if there are 2 threads, say, 1 and 2, it is possible for thread 1 to unblock, block again and then "eat" semaphore raising which was intended for thread 2. Thus, thread 1 does not get blocked when it is assumed to, and incorrect results follow.

To avoid this, a different scheme needs to be implemented for thread stopping/resuming, so that a stopped thread cannot "eat" a resume directed to another thread.