November 01, 2008
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?
> 
> 
> 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?
November 01, 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