Changing thread priority on WCF RIA Service

≯℡__Kan透↙ 提交于 2020-01-04 05:37:19

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/9983136/changing-thread-priority-on-wcf-ria-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!