Thread.sleep (DMD 2.020)

Sean Kelly sean at invisibleduck.org
Sat Nov 1 14:43:45 PDT 2008


John C wrote:
> Sean Kelly Wrote:
> 
>> John C wrote:
>>> Sean Kelly Wrote:
>>>
>>>>> Should I file a bug report?
>>>> Don't bother.  But thanks for the report.
>>>>
>>> Also, any reason why priority is only available once the Thread's handle has been created - ie, after it's been started?
>> Do you mean as opposed to in its ctor?
> 
> Not really - I mean that you should be able to set a Thread object's priority after creation but before start() is called. Currently this doesn't work - an exception is thrown. Perhaps store the requested priority in a field in the class, and SetPriority with that value on the handle after _beginthreadex?

Thread.start() mostly exists to ensure that classes derived from Thread 
  are properly constructed before the thread is started, so I don't 
encourage constructing threads and then letting them sit before starting 
them.  For this reason, there is basically no support built into Thread 
for this "initialized but not started" state.  There's an isRunning 
method but no state method that has an INIT state, for example.  So 
while it would be possible to store thread priority info until the 
thread is started, this would really only support an approach that I 
don't really encourage anyway.  I could probably be convinced to change 
it, but I'm not inclined to right now :)


Sean



More information about the Digitalmars-d mailing list