Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::SpinLock Class Reference

SpinLock. More...

#include <arccore/concurrency/SpinLock.h>

Classes

class  ScopedLock
class  ManualLock

Public Types

enum class  eMode : uint8_t { None , Auto , FullSpin , SpinAndMutex }
 Spinlock mode. The default is 'Auto'. More...

Public Member Functions

 SpinLock ()
 Default SpinLock.
 SpinLock (eMode mode)
 SpinLock with the mode.

Friends

class ScopedLock
class ManualLock

Detailed Description

Member Enumeration Documentation

◆ eMode

enum class Arcane::SpinLock::eMode : uint8_t
strong

Spinlock mode. The default is 'Auto'.

Enumerator
Auto 

Automatic choice.

If Concurrency::getThreadImplementation()->isMultiThread() is true, then the mode is SpinAndMutex. Otherwise, the mode is None.

FullSpin 

Always uses a spinlock.

This type is faster if there is very little contention, but performance is very poor otherwise.

SpinAndMutex 

SpinLock then mutex.

Performs a spinlock then yields (std::this_thread::yield()) if it takes too long. This mode is only available if C++20 is used. Otherwise, it is equivalent to FullSpin.

Definition at line 80 of file arccore/src/concurrency/arccore/concurrency/SpinLock.h.

Constructor & Destructor Documentation

◆ SpinLock() [1/2]

Arcane::SpinLock::SpinLock ( )

Default SpinLock.

Definition at line 36 of file SpinLock.cc.

References SpinAndMutex.

◆ SpinLock() [2/2]

Arcane::SpinLock::SpinLock ( eMode mode)

SpinLock with the mode.

Definition at line 47 of file SpinLock.cc.

◆ ~SpinLock()

Arcane::SpinLock::~SpinLock ( )

Definition at line 57 of file SpinLock.cc.

◆ ManualLock

friend class ManualLock
friend

◆ ScopedLock

friend class ScopedLock
friend

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