On Wednesday, 7 May 2014 at 17:13:07 UTC, Sönke Ludwig wrote:

The Tid handling is currently a little different, but apart from that it
should work like this:

    import vibe.core.core;
    import vibe.core.concurrency;

    void spawnedFunc(Tid tid)
    {
        receive(
          (int i) { writeln("Received the number ", i); }
        );
    }

    // run it as a fiber in the same thread
// note: runTask only takes a delegate to make runTask({ ... })
    // work without an ambiguity error
auto tid = runTask(toDelegate(&spawnedFunc), Task.getThis());

    // or run it in the thread pool instead
    runWorkerTask(&spawnedFunc, Task.getThis());

Having said that, I'll just add a "thisTid" property to
vibe.core.concurrency to make that part API compatible. I'd also add a "spawn" alias, but the question is if that should point to runTask or
rather to runWorkerTask.


BTW, a runnable example can be found here:
https://github.com/rejectedsoftware/vibe.d/blob/master/examples/message/source/app.d

Thanks for the quick answer. I'll give it a try ;-).

Reply via email to