PIP 5.5.3
Platform-Independent Primitives
Public Member Functions | List of all members
PISpinlock Class Reference

Fast and full-load lock. More...

#include <pispinlock.h>

Public Member Functions

 PISpinlock ()
 Constructs unlocked spinlock.
 
 ~PISpinlock ()
 Destroy spinlock.
 
void lock ()
 Lock spinlock. More...
 
void unlock ()
 Unlock spinlock. More...
 

Detailed Description

Fast and full-load lock.

PISpinlock provides critical code section defence between several threads. PISpinlock functionality similar to PIMutex, but working on atomic type and lock() method wait with 100% CPU core load.

For automatic lock-unlock use PISpinlockLocker.

Note

Use this type instead of PIMutex when less waiting time is more important than CPU load!

Member Function Documentation

◆ lock()

void PISpinlock::lock ( )
inline

Lock spinlock.

If spinlock is unlocked it set to locked state and returns immediate. If spinlock is already locked function blocks until spinlock will be unlocked

◆ unlock()

void PISpinlock::unlock ( )
inline

Unlock spinlock.

In any case this function returns immediate