Avoid overload conflict when using TaskMutex together with InterruptibleTaskCondition.
This commit is contained in:
parent
ffa5bd5c58
commit
452fa411c2
|
@ -699,8 +699,14 @@ final class InterruptibleTaskCondition {
|
||||||
|
|
||||||
private TaskConditionImpl!(true, Lockable) m_impl;
|
private TaskConditionImpl!(true, Lockable) m_impl;
|
||||||
|
|
||||||
this(core.sync.mutex.Mutex mtx) { m_impl.setup(mtx); }
|
this(M)(M mutex)
|
||||||
this(Lockable mtx) { m_impl.setup(mtx); }
|
if (is(M : Mutex) || is (M : Lockable))
|
||||||
|
{
|
||||||
|
static if (is(M : Lockable))
|
||||||
|
m_impl.setup(mutex);
|
||||||
|
else
|
||||||
|
m_impl.setupForMutex(mutex);
|
||||||
|
}
|
||||||
|
|
||||||
@property Lockable mutex() { return m_impl.mutex; }
|
@property Lockable mutex() { return m_impl.mutex; }
|
||||||
void wait() { m_impl.wait(); }
|
void wait() { m_impl.wait(); }
|
||||||
|
@ -709,6 +715,12 @@ final class InterruptibleTaskCondition {
|
||||||
void notifyAll() { m_impl.notifyAll(); }
|
void notifyAll() { m_impl.notifyAll(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest {
|
||||||
|
new InterruptibleTaskCondition(new Mutex);
|
||||||
|
new InterruptibleTaskCondition(new TaskMutex);
|
||||||
|
new InterruptibleTaskCondition(new InterruptibleTaskMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** A manually triggered single threaded cross-task event.
|
/** A manually triggered single threaded cross-task event.
|
||||||
|
|
||||||
|
@ -1584,7 +1596,7 @@ private struct TaskConditionImpl(bool INTERRUPTIBLE, LOCKABLE) {
|
||||||
@trusted bool tryLock() { return m_mutex.tryLock(); }
|
@trusted bool tryLock() { return m_mutex.tryLock(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup(core.sync.mutex.Mutex mtx)
|
void setupForMutex(core.sync.mutex.Mutex mtx)
|
||||||
{
|
{
|
||||||
setup(new MutexWrapper(mtx));
|
setup(new MutexWrapper(mtx));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue