www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Thread.sleep (DMD 2.020)

reply John C <johnch_atms hotmail.com> writes:
Sean Kelly Wrote:

 John C wrote:
 Sean Kelly Wrote:
 
 Should I file a bug report?



Do you mean as opposed to in its ctor? Sean

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?
Nov 01 2008
parent Sean Kelly <sean invisibleduck.org> writes:
John C wrote:
 Sean Kelly Wrote:
 
 John C wrote:
 Sean Kelly Wrote:

 Should I file a bug report?




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
Nov 01 2008