On Wed, 24 Feb 2016 09:30:08 GMT, denizzzka wrote:

Hi!

How to call function with arguments from async()?

For example, trying to pass variable "conn" of type "Connection":

auto r = async((Connection c){ return c.waitEndOf(type, timeout); }, conn);

causes error:

../../.dub/packages/vibe-d-0.7.27/source/vibe/core/concurrency.d(1140,23): Error: template vibe.core.core.runTask cannot deduce function from argument types !()(void function(FreeListRef!(shared(bool), true) dst, bool delegate(Connection) @safe callable, Connection param2) @system, FreeListRef!(shared(bool), true), bool delegate(Connection) @safe, Connection), candidates are:
../../.dub/packages/vibe-d-0.7.27/source/vibe/core/core.d(178,6): vibe.core.core.runTask(ARGS...)(void delegate(ARGS) task, ARGS args)
../../.dub/packages/vibe-d-0.7.27/source/vibe/core/concurrency.d(1127,30): Error: function vibe.core.concurrency.async!(bool delegate(Connection) @safe, Connection).async no return exp; or assert(0); at end of function
source/vibe/db/postgresql/package.d(249,19): Error: template instance vibe.core.concurrency.async!(bool delegate(Connection) @safe, Connection) error instantiating
dmd failed with exit code 1.

I've fixed the error on master: a8faddf

The problem was that the non-shared (using runTask for concurrency) path wasn't tested, only the shared one (using runWorkerTask).