From 942089a91c0814e7e1e6eb4a7ab9799278c25310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Tue, 29 Nov 2016 19:17:14 +0100 Subject: [PATCH] Add unit tests for joinding tasks from outside of another task. --- source/vibe/core/core.d | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/vibe/core/core.d b/source/vibe/core/core.d index 0b20a50..ba60376 100644 --- a/source/vibe/core/core.d +++ b/source/vibe/core/core.d @@ -525,12 +525,18 @@ unittest { } } +unittest { // run and join local task from outside of a task + int i = 0; + auto t = runTask({ sleep(5.msecs); i = 1; }); + t.join(); + assert(i == 1); +} + unittest { // run and join worker task from outside of a task __gshared int i = 0; auto t = runWorkerTaskH({ sleep(5.msecs); i = 1; }); - // FIXME: joining between threads not yet supported - //t.join(); - //assert(i == 1); + t.join(); + assert(i == 1); } private void runWorkerTask_unsafe(CALLABLE, ARGS...)(CALLABLE callable, ref ARGS args) @@ -988,7 +994,7 @@ void setTaskEventCallback(TaskEventCallback func) /** A version string representing the current vibe version */ -enum vibeVersionString = "0.7.27"; +enum vibeVersionString = "1.0.0-alpha"; /**