Answers for "cuda locks"

C++
0

cuda locks

//d_lock must be initialized to 0
bool success = false;
while(!success) {
  if (atomicCAS(&d_lock[i], 0, 1) == 0) {

    //critical section
    
	success = true;
    atomicExch(&d_lock[i], 0);
  }
}
Posted by: Guest on May-04-2021

Browse Popular Code Answers by Language