digitalmars.D.bugs - [Issue 6224] New: Make a read-only public ownerTid property for std.concurrency
- d-bugmail puremagic.com (54/54) Jun 29 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6224
- d-bugmail puremagic.com (12/12) Jun 29 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6224
- d-bugmail puremagic.com (22/22) Jan 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6224
- d-bugmail puremagic.com (8/10) Jan 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6224
- d-bugmail puremagic.com (14/14) Jan 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6224
- d-bugmail puremagic.com (11/11) Mar 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6224
- d-bugmail puremagic.com (10/10) Mar 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6224
http://d.puremagic.com/issues/show_bug.cgi?id=6224 Summary: Make a read-only public ownerTid property for std.concurrency Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 14:39:31 PDT --- I need a way to get the Tid of the thread that spawned the current thread. I've had this kind of bug creep into my code: __gshared Tid mainThread; __gshared Tid workThread; workThreadFoo() { workThread.send("data"); // Bug: Meant to be mainThread.send } mainThreadFoo() { mainThread = thisTid; workThread = spawn(&workThreadFoo); } This can be taken care of with this workaround: workThreadFoo() { Tid mainThread = receiveOnly!Tid(); // workThread.send("data"); // Now this can't creep in mainThread.send("data"); // correct } mainThreadFoo() { Tid workThread = spawn(&workThreadFoo); workThread.send(thisTid); } But it would be better if I didn't have to take this extra step and instead used: workThreadFoo() { Tid mainThread = thisTid.ownerTid; // new read-only property mainThread.send("data"); // correct thisTid.ownerTid.send("data2"); // also correct } mainThreadFoo() { Tid workThread = spawn(&workThreadFoo); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 29 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6224 16:11:36 PDT --- I forgot I can also use spawn to send the Tid, e.g.: void workThreadFoo(Tid mainThread) { } spawn(&workThreadFoo, thisTid); It would still be nice to have a ownerTid property though, this is a feature request. :) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 29 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6224 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Windows |All 15:22:35 PST --- Ok apparently there's a global but private 'owner' Tid. The problem is this is equal to Tid.init for the main thread since Tid is a struct. I don't think it's wise to simply return: /** * Return the Tid of the thread which * spawned the caller's thread. */ property Tid ownerTid() { return owner; } As calling ownerTid.send() will segfault due to mbox being null. So what should be done instead, maybe throw an exception in ownerTid() if mbox is null? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6224 15:24:33 PST ---The problem is this is equal to Tid.init for the main thread since Tid is a struct.That wasn't worded properly. It's .init because it doesn't have a parent, regardless of whether it's a struct or class. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6224 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull AssignedTo|nobody puremagic.com |andrej.mitrovich gmail.com Summary|Make a read-only public |Add an ownerTid property in |ownerTid property for |std.concurrency |std.concurrency | 15:59:50 PST --- https://github.com/D-Programming-Language/phobos/pull/1092 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6224 Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/dd9b31ccaef70915c7a2b18b05d9f699fbb4ae5f Fixes Issue 6224 - Add ownerTid() property. https://github.com/D-Programming-Language/phobos/commit/9cb2065fe6f2302a3c47f1aff3e005de5c90c110 Issue 6224 - Add ownerTid() property. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6224 Alex Rønne Petersen <alex lycus.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |alex lycus.org Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 08 2013