Example: GPU lock
while(atomicCAS(lock,0,id) != 0) {} // wait to acquire lock
// ... do single thread code ...
atomicExcg(lock,0); // release lock
- SIMD GPU continues loops until all threads exit
- One thread gets lock, but doesn't continue because others are still in loop
- Lock is never released