English 中文(简体)
如何实施反馈/程序/消费计划?
原标题:How to implement a callback/producer/consumers scheme?

I m 变暖与服装,并开始撰写一些简单的功能。

我理解这些语言显然适合平行计算,这让我思考。 我收到一本书(在 Java写,但不管怎样做):

  • 有一个线索等待投入(我的档案系统,但可以是网络,也可以是任何东西),一旦输入点,就会提出这种投入。

  • 几个消费者通过该组收集的数据,同时处理数据

将投入放在平行处理之中的法典可能照此办理(仅举一个例子):

asynchFetchInput( new MyCallBack() {
    public void handle( Input input ) {
        queue.put(input)
    }
})

<asynchFetchInputspawn a Thread, 然后打电话回。

这确实只是一个例子,但如果有人能够解释如何用克隆法做类似的事情,那将大大帮助我理解“夸张画”。

问题回答

如果你必须改变数据,你可以将其转化为以下数据,那么你可以将其输入到<条码>>>>><>>>>>>>>>>>>> 或<条码><><>>>>>>>。 后者将同时处理。

你们也许还要看一下基本 Java的一致公用事业,而不是看你自己的read子。





相关问题
c# stack queue combination

is there in C# some already defined generic container which can be used as Stack and as Queue at the same time? I just want to be able to append elements either to the end, or to the front of the ...

Packet Queue in Python?

is there any way to queue packets to a socket in Python? I ve been looking for something like the libipq library, but can t find anything equivalent. Here s what I m trying to accomplish: Create ...

Java Queue Merge, Beginner

I m trying to write a method that will take in two Queues (pre-sorted Linked Lists) and return the merged, in ascending order, resulting Queue object. I pasted the Queue class, the merge method ...

Efficient queue in Haskell

How can I efficiently implement a list data structure where I can have 2 views to the head and end of the list, that always point to a head a tail of a list without expensive calls to reverse. i.e: ...

Thread & Queue vs Serial performance

I though it ll be interesting to look at threads and queues, so I ve written 2 scripts, one will break a file up and encrypt each chunk in a thread, the other will do it serially. I m still very new ...

Insert into an STL queue using std::copy

I d like to use std::copy to insert elements into a queue like this: vector<int> v; v.push_back( 1 ); v.push_back( 2 ); queue<int> q; copy( v.begin(), v.end(), insert_iterator< queue&...

Threading in Ruby with a limit

I have a task I need to perform, do_stuff(opts), that will take ~1s each, even while 1 - 10 of them are running in parallel. I need to collect an array of the results for each operation at the end. ...

热门标签