std.concurrency.receive() question
Ruslan Mullakhmetov
nobody at example.com
Sun Aug 11 06:04:36 PDT 2013
i try to compile the following slightly modified sample from the
book and it failed with the following messages
======= source ============
import std.stdio;
import std.concurrency;
void fileWriter()
{
// Write loop
for (bool running = true; running; )
{
receive(
(immutable(ubyte)[] buffer) {},
(OwnerTerminated) { running = false; }
);
}
stderr.writeln("Normally terminated.");
}
void main()
{
}
====== error messages =======
/Users/ruslan/Source/dlang/dub-test/source/listener.d(11): Error:
template std.concurrency.receive does not match any function
template declaration. Candidates are:
/usr/local/Cellar/dmd/2.063.2/libexec/src/phobos/std/concurrency.d(646):
std.concurrency.receive(T...)(T ops)
/Users/ruslan/Source/dlang/dub-test/source/listener.d(11): Error:
template std.concurrency.receive(T...)(T ops) cannot deduce
template function from argument types !()(void
function(immutable(ubyte)[] buffer) pure nothrow @safe, void)
========================
what's wrong? if i replace OwnerTerminated with int or simply
remove everything is ok.
if i replace with my own struct Terminate - fail.
any help would be appreciated.
More information about the Digitalmars-d
mailing list