queue

C++ bound method queue (task manager/scheduler?)

大兔子大兔子 提交于 2019-12-07 22:46:38
问题 Is there a method/pattern/library to do something like that (in pseudo-code): task_queue.push_back(ObjectType object1, method1); task_queue.push_back(OtherObjectType object2, method2); so that I could do the something like: for(int i=0; i<task_queue.size(); i++) { task_queue[i].object -> method(); } so that it would call: obj1.method1(); obj2.method2(); Or is that an impossible dream? And if there's a way to add a number of parameters to call - that would be the best. Doug T. please see this

phpleague flysystem read and write to large file on server

我与影子孤独终老i 提交于 2019-12-07 18:26:04
问题 I am using flysystem with IRON IO queue and I am attempting to run a DB query that will be taking ~1.8 million records and while doing 5000 at at time. Here is the error message I am receiving with file sizes of 50+ MB: PHP Fatal error: Allowed memory size of ########## bytes exhausted Here are the steps I would like to take: 1) Get the data 2) Turn it into a CSV appropriate string (i.e. implode(',', $dataArray) . "\r\n" ) 3) Get the file from the server (in this case S3) 4) Read that files'

How to implement a dequeue using two stacks

左心房为你撑大大i 提交于 2019-12-07 18:19:41
问题 Dequeue - Doubly ended queue: en-queue and de-queue possible from both ends. How to define ADT operations for dequeue using 2 stacks. Implementation should also take into consideration the performance. 回答1: the simplest solution would be to use one stack as the head of the queue, and one as the tail. The enqueue operations would just be a push to the respective stack, and the dequeue operations would just be a pop on the respective stack. However, if the stack you want to dequeue from is

Writing a global animation queue in jquery

本小妞迷上赌 提交于 2019-12-07 18:16:45
问题 Adding a sequence of animations to a single dom element using jQuery is extremely easy. jQuery queues everything up nicely for me and I basically don't have to do anything. However making a sequence of animations over a number of elements (eg pictureDiv fades out, then demographicsDiv fades in) is much harder. I've written a plugin type thing to make it easier as below: var something.createAnimationQueue = function () { // jQuery queues up animations on each dom element (/ jquery object) //

deadlock because of blocking Queue.get() method

前提是你 提交于 2019-12-07 17:03:58
问题 As the title implies I have a deadlock and no idea why. I have multiple producers and only one consumer. The schedule_task method will get called by multiple processes after the thread has called the get method of the queue from logging import getLogger from time import sleep from threading import Event, Thread from multiprocessing import Process from Queue import Queue class TaskExecutor(object): def __init__(self): print("init taskExecutor") self.event = Event() self.taskInfos = Queue()

Python Multiprocessing Queue on Parent Exit

♀尐吖头ヾ 提交于 2019-12-07 16:55:52
问题 The gist of my question is what happens to a multiprocessing queue when the parent (a daemon in this circumstance) is killed. I have a daemon that runs in the background which queues up jobs for child processes: class manager(Daemon): def run(self): someQueue = MP.Queue() someChild = MP.Process(target=someCode, args=(someArgs)) someChild.start() ... If the manager is killed (assuming it wasn't trying to use someQueue and therefore corrupted it as mentioned in the documentation), is there

Python - Using threads or a queue to iterate over a for loop that calls a function

主宰稳场 提交于 2019-12-07 16:25:15
问题 I'm fairly new to python and am making a script that allows one to bring point cloud data from other programs into Autodesk Maya. I have my script functioning fine but what i'm trying to do is make it faster. I have a for loop that iterates through a list of numbered files. I.e. datafile001.txt, datafile002.txt and so on. Is what i'm wondering is if there is a way to have it to do more then one at a time, possibly using threads or a queue? Below I have the code i have been working on: def

The Most Efficient Implementation of UniqueQueue and UniqueReplacementQueue Collections in .NET

雨燕双飞 提交于 2019-12-07 15:54:18
问题 What is the most efficient (in terms of speed) implementation of UniqueQueue and UniqueReplacementQueue collections in .NET considering the fact that the speed of Enqueue and Dequeue operations is equally important. UniqueQueue is a queue where duplicates are not possible. So if I push an element to the queue it is added in only case it doesn't already exist in the queue. UniqueReplacementQueue is a queue where duplicates are not possible either. The difference is that if I push an element

concurrent 包 BlockingQueue

寵の児 提交于 2019-12-07 15:27:53
认识队列: 从上图我们可以很清楚看到,通过一个共享的队列,可以使得数据由队列的一端输入,从另外一端输出; 常用的队列主要有以下两种:(当然通过不同的实现方式,还可以延伸出很多不同类型的队列,DelayQueue就是其中的一种)   先进先出(FIFO):先插入的队列的元素也最先出队列,类似于排队的功能。从某种程度上来说这种队列也体现了一种公平性。   后进先出(LIFO):后插入队列的元素最先出队列,这种队列优先处理最近发生的事件。 实现两者之间的数据共享。假设我们有若干生产者线程,另外又有若干个消费者线程。如果生产者线程需要把准 多线程环境中,通过队列可以很容易实现数据共享,比如经典的“生产者”和“消费者”模型中,通过队列可以很便利地备好的数据共享给消费者线程,利用队列的方式来传递数据,就可以很方便地解决他们之间的数据共享问题。但如果生产者和消费者在某个时间段内,万一发生数据处理速度不匹配的情况呢?理想情况下,如果生产者产出数据的速度大于消费者消费的速度,并且当生产出来的数据累积到一定程度的时候,那么生产者必须暂停等待一下(阻塞生产者线程),以便等待消费者线程把累积的数据处理完毕,反之亦然。然而,在concurrent包发布以前,在多线程环境下,我们每个程序员都必须去自己控制这些细节,尤其还要兼顾效率和线程安全,而这会给我们的程序带来不小的复杂度。好在此时

Pause MDB message Processing

血红的双手。 提交于 2019-12-07 13:16:27
Can we pause the MDB message processing for some time? For example: Jboss 1-deployed MDB for message processing. Jboss 2:-Bean for gathering user details. If the MDB from jboss 1 calls bean in jboss 2 for getting users details. If this is the case, when we restart the Jboss 2, we need to pause the MDB in jboss 1 till the jboss 2 is UP. Is there any option to pause MDB, so that we can avoid failure of message? I doubt you can stop an MDB without stopping the whole application. It is possible with Spring JMS, but not with regular message driven beans. What you could do, and is apparently