vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Struct ScopedMutexLock

RAII lock for the Mutex class.

struct ScopedMutexLock(M)
  
if (is(shared(M) : shared(Mutex)) || is(shared(M) : shared(Lockable)));

Constructors

NameDescription
this (mutex, mode)

Fields

NameTypeDescription
m_locked bool
m_mode LockMode
m_mutex M

Properties

NameTypeDescription
locked[get] bool

Methods

NameDescription
lock ()
tryLock ()
unlock ()

Example

int protected_var = 0;
auto mtx = new TaskMutex;
mtx.performLocked!({
	protected_var++;
});
Authors

Leonid Kramer, Sönke Ludwig, Manuel Frischknecht

Copyright

© 2012-2019 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.