Add assertions for uninitialized LocalManualEvents.

This commit is contained in:
Sönke Ludwig 2017-07-20 16:48:24 +02:00
parent a6eeae97f3
commit be0de0a733

View file

@ -716,6 +716,7 @@ struct LocalManualEvent {
/// Emits the signal, waking up all owners of the signal.
int emit()
nothrow {
assert(m_waiter !is null, "LocalManualEvent is not initialized - use createManualEvent()");
logTrace("unshared emit");
auto ec = m_waiter.m_emitCount++;
m_waiter.emit();
@ -725,6 +726,7 @@ struct LocalManualEvent {
/// Emits the signal, waking up a single owners of the signal.
int emitSingle()
nothrow {
assert(m_waiter !is null, "LocalManualEvent is not initialized - use createManualEvent()");
logTrace("unshared single emit");
auto ec = m_waiter.m_emitCount++;
m_waiter.emitSingle();
@ -768,6 +770,8 @@ struct LocalManualEvent {
{
import std.datetime : Clock, SysTime, UTC;
assert(m_waiter !is null, "LocalManualEvent is not initialized - use createManualEvent()");
SysTime target_timeout, now;
if (timeout != Duration.max) {
try now = Clock.currTime(UTC());