D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3891 - core.Thread constructors don't accept shared delegates
Summary: core.Thread constructors don't accept shared delegates
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-07 20:37 UTC by Justin Spahr-Summers
Modified: 2015-06-09 01:27 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Justin Spahr-Summers 2010-03-07 20:37:07 UTC
It seems logical that Thread objects should be constructed with delegates marked "shared," but there's no way to do this right now:

---
import core.thread;

class A {
    void doSomethingMultithreaded () shared {
        // blah blah
    }
}

void main () {
    auto a = new shared(A)();
    auto t = new Thread(&a.doSomethingMultithreaded);
    t.start();
}
---

Even in lieu of making it mandatory, an overloaded constructor making use of this would be helpful.
Comment 1 Justin Spahr-Summers 2010-03-07 20:51:11 UTC
Just noticed this newsgroup post too:
http://www.digitalmars.com/d/archives/digitalmars/D/Concurrency_architecture_for_D2_104120.html#N104479

Which I guess makes this whole report moot.