Priority Backgroundworkerthread

  • Thread starter Thread starter Analizer1
  • Start date Start date
A

Analizer1

how to set priority on a backgroundworker thread
when i create the thread , do i use
thread.currentthread


not sure how to accomplish this
thanks
 
Analizer1,

No, you have a Thread instance when you create a Thread, so you set the
Priority property on that instance.

Mind you, setting the thread priority is usually not a good idea for
most scenarios.
 
I am Using "BackgroundWorker" , which is new in .net20
i dont see the thread Properties for this class

tks

Nicholas Paldino said:
Analizer1,

No, you have a Thread instance when you create a Thread, so you set the
Priority property on that instance.

Mind you, setting the thread priority is usually not a good idea for
most scenarios.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Analizer1 said:
how to set priority on a backgroundworker thread
when i create the thread , do i use
thread.currentthread


not sure how to accomplish this
thanks
 
I am Using "BackgroundWorker" , which is new in .net20
i dont see the thread Properties for this class

You would use Thread.CurrentThread to get the current thread for setting
the priority.

That said, you should pay very close attention to Nicholas's statement
about setting thread priority being a bad idea in most scenarios.

It is almost always the case that if you think you need to set the thread
priority, you're wrong. This is especially true in managed applications,
since they rarely support the kinds of things that would actually benefit
from setting thread priorities.

Pete
 
In addition to what Peter said, my confusion came from the fact that you
capitalized Backgroundworkerthread in the post title, lower-cased it in the
post itself (and never correctly referenced the BackgroundWorker instance).
There is a property called IsBackground on the Thread instance which causes
it to be a background thread.

Sorry for the confusion.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Analizer1 said:
I am Using "BackgroundWorker" , which is new in .net20
i dont see the thread Properties for this class

tks

Nicholas Paldino said:
Analizer1,

No, you have a Thread instance when you create a Thread, so you set
the Priority property on that instance.

Mind you, setting the thread priority is usually not a good idea for
most scenarios.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Analizer1 said:
how to set priority on a backgroundworker thread
when i create the thread , do i use
thread.currentthread


not sure how to accomplish this
thanks
 
thanks for the Response..
and the information..

dave


Nicholas Paldino said:
In addition to what Peter said, my confusion came from the fact that
you capitalized Backgroundworkerthread in the post title, lower-cased it
in the post itself (and never correctly referenced the BackgroundWorker
instance). There is a property called IsBackground on the Thread instance
which causes it to be a background thread.

Sorry for the confusion.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Analizer1 said:
I am Using "BackgroundWorker" , which is new in .net20
i dont see the thread Properties for this class

tks

Nicholas Paldino said:
Analizer1,

No, you have a Thread instance when you create a Thread, so you set
the Priority property on that instance.

Mind you, setting the thread priority is usually not a good idea for
most scenarios.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


how to set priority on a backgroundworker thread
when i create the thread , do i use
thread.currentthread


not sure how to accomplish this
thanks
 
Back
Top