Pol  Revision:cb584c9
Pol::Clib::SpinLock Class Reference

#include <spinlock.h>

Public Member Functions

 SpinLock ()
 ~SpinLock ()

Private Member Functions

void lock ()
void unlock ()

Private Attributes

std::atomic_flag _lck


class std::lock_guard< SpinLock >

Detailed Description

This is a much faster replacement for mutex when locking very small and fast running protected parts. It is based on a busy loop.

use it only through SpinLockGuard

Definition at line 17 of file spinlock.h.

Constructor & Destructor Documentation

Pol::Clib::SpinLock::SpinLock ( )

Definition at line 35 of file spinlock.h.

References _lck.

Pol::Clib::SpinLock::~SpinLock ( )

Definition at line 39 of file spinlock.h.

Member Function Documentation

void Pol::Clib::SpinLock::lock ( )

Puts the caller in an endless busy loop until it acquires the lock

Definition at line 44 of file spinlock.h.

References _lck.

void Pol::Clib::SpinLock::unlock ( )

Releases the lock

Definition at line 54 of file spinlock.h.

References _lck.

Friends And Related Function Documentation

friend class std::lock_guard< SpinLock >

Definition at line 19 of file spinlock.h.

Member Data Documentation

std::atomic_flag Pol::Clib::SpinLock::_lck

Definition at line 29 of file spinlock.h.

Referenced by lock(), SpinLock(), and unlock().

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