user1060500
user1060500

Reputation: 1535

Changing thread priority on WCF RIA Service

We're currently changing the thread priority of a WCF RIA service call using this code.

System.Threading.Thread.CurrentThread.Priority = System.Threading.ThreadPriority.Lowest;

Once, the operation is invoked, we change the priority to the lowest priority and the operation continues to run.

Will this have potential negative affects on other operations that are running. Also, how are these threads even handled on the server in terms of which operations get run on each thread. Am I potentially changing the thread priority of other operations that are invoked on the same thread or can I be assured that with every RIA service operation that is invoked, a new thread is created for that operation.

Any help is appreciated

Upvotes: 2

Views: 491

Answers (1)

Brian Gideon
Brian Gideon

Reputation: 48949

Also, how are these threads even handled on the server in terms of which operations get run on each thread.

A WCF call is generally dispatched to a thread managed by a thread pool. Once that thread has serviced the request it is returned to the pool.

Will this have potential negative affects on other operations that are running.

It may if the thread pool does not revert the priority back to normal. Remember, that thread will eventually get used to service other requests and work items.

Am I potentially changing the thread priority of other operations that are invoked on the same thread or can I be assured that with every RIA service operation that is invoked, a new thread is created for that operation.

No, a new thread is not created for each request. Yes, you may end up effecting other operations that are dispatched to that thread at a later time.

Upvotes: 2

Related Questions