OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
cub::Mutex Struct Reference

Detailed Description

Simple portable mutex

  • Wraps std::mutex when compiled with C++11 or newer (supported on all platforms)
  • Uses GNU/Windows spinlock mechanisms for pre C++11 (supported on x86/x64 when compiled with cl.exe or g++)

Definition at line 72 of file mutex.cuh.

Public Types

typedef int Spinlock
 

Public Member Functions

__forceinline__ void _ReadWriteBarrier ()
 
__forceinline__ long _InterlockedExchange (volatile int *const Target, const int Value)
 
__forceinline__ void YieldProcessor ()
 
 Mutex ()
 
__forceinline__ void Lock ()
 
__forceinline__ void Unlock ()
 

Data Fields

volatile Spinlock lock
 Lock member.
 

Member Typedef Documentation

◆ Spinlock

typedef int cub::Mutex::Spinlock

Definition at line 103 of file mutex.cuh.

Constructor & Destructor Documentation

◆ Mutex()

cub::Mutex::Mutex ( )
inline

Constructor

Definition at line 138 of file mutex.cuh.

Member Function Documentation

◆ _InterlockedExchange()

__forceinline__ long cub::Mutex::_InterlockedExchange ( volatile int *const  Target,
const int  Value 
)
inline

Atomic exchange

Definition at line 116 of file mutex.cuh.

◆ _ReadWriteBarrier()

__forceinline__ void cub::Mutex::_ReadWriteBarrier ( )
inline

Compiler read/write barrier

Definition at line 108 of file mutex.cuh.

◆ Lock()

__forceinline__ void cub::Mutex::Lock ( )
inline

Return when the specified spinlock has been acquired

Definition at line 143 of file mutex.cuh.

◆ Unlock()

__forceinline__ void cub::Mutex::Unlock ( )
inline

Release the specified spinlock

Definition at line 156 of file mutex.cuh.

◆ YieldProcessor()

__forceinline__ void cub::Mutex::YieldProcessor ( )
inline

Pause instruction to prevent excess processor bus usage

Definition at line 126 of file mutex.cuh.

Field Documentation

◆ lock

volatile Spinlock cub::Mutex::lock

Lock member.

Definition at line 133 of file mutex.cuh.


The documentation for this struct was generated from the following file: