try_lock

try_lock#

stdgpu: stdgpu::try_lock
stdgpu Latest
Efficient STL-like Data Structures on the GPU

◆ try_lock()

template<typename Lockable1 , typename Lockable2 , typename... LockableN>
STDGPU_DEVICE_ONLY int stdgpu::try_lock ( Lockable1  lock1,
Lockable2  lock2,
LockableN...  lockn 
)

Tryies to lock all the locks at the given positions {lock1, lock2, ..., lockn} for some n >= 1.

Parameters
[in]lock1The first lock
[in]lock2The second lock
[in]locknThe remaining n - 2 locks
Returns
-1 if locking was successful, the first position at which locking failed otherwise