Something weird with threads.
BizarreCake
bizarrecake at gmail.com
Sun Aug 7 09:06:51 PDT 2011
While messing with threads from std.concurrency, I've been getting
this weird problem.
The code below, runs perfectly fine.
-------------------------------------------
import std.concurrency;
void main( ) {
spawn( &func );
}
void func( ) {
}
--------------------------------------------
But when func( ) is moved to a class:
-------------------------------------------
import std.concurrency;
void main( ) {
auto c = new C;
spawn( &c.func );
}
class C {
void func( ) {
}
}
--------------------------------------------
doesn't compile at all. It produces the following errors:
- Error: template std.concurrency.spawn(T...) does not match any
function template declaration
- Error: template std.concurrency.spawn(T...) cannot deduce
template function from argument types !()(void delegate())
Am I doing it wrong? Is there a workaround?
Thanks.
More information about the Digitalmars-d-learn
mailing list