Bug 1966 – Allow for Derived Thread Classes

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-04-01T08:04:00Z
Last change time
2015-11-03T19:12:14Z
Assigned to
nobody
Creator
bcwhite

Comments

Comment #0 by bcwhite — 2008-04-01T08:04:15Z
As far as I can tell, it's not possible to create a class derived from Thread and have it apply to the main thread. This is because the "static void thread_init()" function internally does a "new Thread()". Thus, if I want to create a derived class, I must duplicate this function in it's entirety rather than just call it as part of the derived "thread_init". How about having the existing class take a single Thread parameter that defaults to "null" and only allocate a new object if "null" is received. public static void thread_init(Thread t = null) { if (t is null) { t = new Thread(); } ... } I would then have my derived thread class define its own function like this... public static void thread_init(MyThread t = null) { if (t is null) { t = new MyThread(); } Thread.thread_init(t); ... }
Comment #1 by andrej.mitrovich — 2014-04-24T14:50:02Z
Is this bug still relevant today?
Comment #2 by andrei — 2015-11-03T19:12:14Z
It's unlikely this D1 issue will get worked on. If it applies to D2 as well and/or if anyone plans to work on it, please reopen.