diff --git a/source/vibe/core/core.d b/source/vibe/core/core.d index 2d1af35..953cbc4 100644 --- a/source/vibe/core/core.d +++ b/source/vibe/core/core.d @@ -656,6 +656,19 @@ void runWorkerTaskDist(alias method, T, ARGS...)(shared(T) object, ARGS args) setupWorkerThreads(); return st_workerPool.runTaskDist!method(object, args); } +/// ditto +void runWorkerTaskDist(FT, ARGS...)(TaskSettings settings, FT func, auto ref ARGS args) + if (is(typeof(*func) == function)) +{ + setupWorkerThreads(); + return st_workerPool.runTaskDist(settings, func, args); +} +/// ditto +void runWorkerTaskDist(alias method, T, ARGS...)(TaskSettings settings, shared(T) object, ARGS args) +{ + setupWorkerThreads(); + return st_workerPool.runTaskDist!method(settings, object, args); +} /** Runs a new asynchronous task in all worker threads and returns the handles. @@ -671,6 +684,13 @@ void runWorkerTaskDistH(HCB, FT, ARGS...)(scope HCB on_handle, FT func, auto ref setupWorkerThreads(); st_workerPool.runTaskDistH(on_handle, func, args); } +/// ditto +void runWorkerTaskDistH(HCB, FT, ARGS...)(TaskSettings settings, scope HCB on_handle, FT func, auto ref ARGS args) + if (is(typeof(*func) == function)) +{ + setupWorkerThreads(); + st_workerPool.runTaskDistH(settings, on_handle, func, args); +} /** diff --git a/source/vibe/core/taskpool.d b/source/vibe/core/taskpool.d index cd1aa67..f862ab5 100644 --- a/source/vibe/core/taskpool.d +++ b/source/vibe/core/taskpool.d @@ -261,6 +261,12 @@ shared final class TaskPool { See_also: `runTaskDist` */ void runTaskDistH(HCB, FT, ARGS...)(scope HCB on_handle, FT func, auto ref ARGS args) + if (!is(HCB == TaskSettings)) + { + runTaskDistH(TaskSettings.init, on_handle, func, args); + } + /// ditto + void runTaskDistH(HCB, FT, ARGS...)(TaskSettings settings, scope HCB on_handle, FT func, auto ref ARGS args) { // TODO: support non-copyable argument types using .move import std.concurrency : send, receiveOnly; @@ -277,7 +283,7 @@ shared final class TaskPool { t.tid.send(Task.getThis()); func(args); } - runTaskDist(&call, caller, func, args); + runTaskDist(settings, &call, caller, func, args); foreach (i; 0 .. this.threadCount) on_handle(receiveOnly!Task);