Skip to content

yvoinov/adaptive-spin-mutex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Adaptive Spin Mutex

License

Introduction

This improved version of the adaptive spin mutex is inspired by an article by Foster Brereton.

It has been field-tested for many years in real-world applications and has been slightly improved to achieve better performance.

Installation

Since the class is implemented as a header module (C++11 is required), it is enough to throw it into your project and include it with compiler directive.

Usage

Since the class is implemented with an interface that is fully compatible with mutex wrapper classes, it is easily used as a replacement for standard mutexes:

	AdaptiveSpinMutex spmux(m_lock);
	std::lock_guard<AdaptiveSpinMutex> lock(spmux);
	...
	}
private:
	std::atomic<bool>& m_lock;
...

Notes

Class optimized for any C++11 compliant compiler, tested on GCC, Clang, Oracle Developer Studio.

Releases

No releases published

Packages

No packages published

Languages