English 中文(简体)
C# 4.0 and queue with limited non-dicated threadrix threaduser
原标题:C# 4.0 and queue with limited non-dedicated threadpool threads consumers

C# 4.0 s new BlockingCollection doesn t answer a simple requirement we need:
* Concurrent-queue for tasks items.
* Consumers - limited N threads at a time - from the threadpool (threads which are not dedicated to this queue and are not blocked if there are no items in the queue). especially useful for resources usage we need to limit with only one (N = 1) thread at a time and the queue can be empty from time to time.

为此,利用面积为1的校对组,执行冰。

I was looking for a nice solution with the new C# 4.0 parallel lib, leveraging the .Net internal threadpool. I can think of a few solutions for this, but I wonder if there s something elegant which I m missing.

你认为什么?

Regards, Shlomi

最佳回答
问题回答

地下池的 Task块。 虽然在4.NET中已经开展了帮助支助工作,但Threadrix isn实际上指长期任务,而且肯定不指阻碍行动(如果read平的开端时间微不足道,那么你最好把自己read起来)。

如果像你这样想再做的话,那么你可能比照<代码>。 IObservable enuff. 审视一下与可保存的冰箱(活性)有关的某些真正冷却的延伸。 否则,国际不动产协会只能处理一次申请,但你可以很容易地将每一物体寄给你,将其扔到地下池(实际加工)和(或)使用TPL。 一支具有最大平行的工作队可能会帮助你来到这里。

我只能想一想一下你重新寻找的东西。 您不妨用和你可以控制的几条工人胎面编码填写<代码>Con Current Queue。





相关问题
Setting minimum threads in thread pool

I have an application with 4 worker threads from the thread pool. It was waking up every 0.5 second. as written in msdn the thread pool monitors every 0,5 second to create idle threads. I set the ...

Threads in WCF service

there is a piece of code: class WCFConsoleHostApp : IBank { private static int _instanceCounter; public WCFConsoleHostApp () { Interlocked.Increment(ref _instanceCounter); ...

Threadpool is getting used by windows service problem

I have created a windows service which is currently having three timers. First timer is waking up every 15 sec, second timer is waking every min. and the third timer is waking everyday. THe problem ...

Is this a right case for using the Threadpool?

Here s the setup: I m trying to make a relatively simple Winforms app, a feed reader using the FeedDotNet library. The question I have is about using the threadpool. Since FeedDotNet is making ...

热门标签