From be0de0a733c500c1d03e21d9123d9713bccf442e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 20 Jul 2017 16:48:24 +0200 Subject: [PATCH] Add assertions for uninitialized LocalManualEvents. --- source/vibe/core/sync.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/vibe/core/sync.d b/source/vibe/core/sync.d index 7f5edcc..aaf298f 100644 --- a/source/vibe/core/sync.d +++ b/source/vibe/core/sync.d @@ -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());