更改 WCF RIA 服务上的线程优先级 [英] Changing thread priority on WCF RIA Service

查看:41
本文介绍了更改 WCF RIA 服务上的线程优先级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在使用此代码更改 WCF RIA 服务调用的线程优先级.

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.

这是否会对正在运行的其他操作产生潜在的负面影响.此外,就每个线程上运行哪些操作而言,这些线程如何在服务器上进行处理.我是否可能会更改在同一线程上调用的其他操作的线程优先级,或者我是否可以确保每次调用 RIA 服务操作时,都会为该操作创建一个新线程.

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.

感谢任何帮助

推荐答案

此外,这些线程在服务器上是如何处理的在每个线程上运行哪些操作.

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

WCF 调用通常被分派到由线程池管理的线程.一旦该线程为请求提供服务,它就会返回到池中.

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.

我是否可能改变其他操作的线程优先级在同一个线程上调用,或者我可以放心,每个 RIA调用的服务操作,为此创建一个新线程操作.

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.

这篇关于更改 WCF RIA 服务上的线程优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆