I am sure I am just missing something simple, but I need the nudge… I can do:
import core.thread ;
import std.stdio ;
int main(immutable string[] args) {
auto f() { return delegate () { writeln("Hello World."); }; }
auto t = new Thread(f);
t.start();
t.join();
return 0;
}
it is Thread(f) rather than Thread(&f) because f is a function returning
a void delegate() rather than being a void(). However:
import core.thread ;
import std.stdio ;
int main(immutable string[] args) {
auto t = new Thread( delegate () { return delegate () {
writeln("Hello World."); }; } ) ;
t.start();
t.join();
return 0;
}
trial.d(7): Error: constructor core.thread.Thread.this (void function()
fn, ulong sz = cast(ulong)0) is not callable using argument types (void
delegate() delegate() pure nothrow @safe)
Failed: 'dmd' '-v' '-o-' 'trial.d' '-I.'
So I cannot use an anonymous delegate where I can use a named delegate?
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
