Make scopedMutexLock work with InterruptibleTaskMutex.
This commit is contained in:
parent
452fa411c2
commit
fb64c07d3c
|
@ -33,11 +33,18 @@ shared(ManualEvent) createSharedManualEvent()
|
|||
return shared(ManualEvent).init;
|
||||
}
|
||||
|
||||
ScopedMutexLock!M scopedMutexLock(M : Mutex)(M mutex, LockMode mode = LockMode.lock)
|
||||
ScopedMutexLock!M scopedMutexLock(M)(M mutex, LockMode mode = LockMode.lock)
|
||||
if (is(M : Mutex) || is(M : Lockable))
|
||||
{
|
||||
return ScopedMutexLock!M(mutex, mode);
|
||||
}
|
||||
|
||||
unittest {
|
||||
scopedMutexLock(new Mutex);
|
||||
scopedMutexLock(new TaskMutex);
|
||||
scopedMutexLock(new InterruptibleTaskMutex);
|
||||
}
|
||||
|
||||
enum LockMode {
|
||||
lock,
|
||||
tryLock,
|
||||
|
@ -53,7 +60,8 @@ interface Lockable {
|
|||
|
||||
/** RAII lock for the Mutex class.
|
||||
*/
|
||||
struct ScopedMutexLock(M : Mutex = core.sync.mutex.Mutex)
|
||||
struct ScopedMutexLock(M)
|
||||
if (is(M : Mutex) || is(M : Lockable))
|
||||
{
|
||||
@disable this(this);
|
||||
private {
|
||||
|
|
Loading…
Reference in a new issue