queue

Real time plotting with Matplotlib, PyQt and Threading ends to python crash

大兔子大兔子 提交于 2020-01-04 12:47:47
问题 I've been struggling with my Python application and I can't find any answers. I'm having PyQT GUI application which uses Matplotlib widget. GUI starts a new thread which handles plotting to mpl widget. I'm afraid I run now to a race condition by accessing matplotlib drawing components from another thread which leads to crash. This is basically, what my code looks like: class Analyzer(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): self.timer = QTimer() super(Analyzer, self)._

Cloning queue in c#

倖福魔咒の 提交于 2020-01-04 09:55:34
问题 I have the following code: Queue<string> oldQueue = new Queue<string>(); oldQueue.Enqueue("One"); oldQueue.Enqueue("Two"); oldQueue.Enqueue("Three"); Queue newQueue = oldQueue; string newString = newQueue.Dequeue(); The problem is that once I Dequeue the item from newQueue , the item is also Dequeued from oldQueue . Is there a way to "clone" a queue in a way that removing an item from one queue will keep it's clone queue unchanged? 回答1: Queue is a reference type, so newQueue and oldQueue

PHP Queue System with Codeigniter. HOW? [closed]

陌路散爱 提交于 2020-01-04 09:27:07
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I am creating a website for a client where they need the ability to generate 25,000 - 100,000 barcodes. I have licensed a software that generates the codes but it takes around 20 - 30 minutes to generate an order

Using Reflection to call a method on a field

て烟熏妆下的殇ゞ 提交于 2020-01-04 09:16:14
问题 Okay been working on this too long and can't get it to work. I have a list of Thread types that can be different classes i.e. WriteFileData(extends Thread). I want to for loop through that list and do a call to add to queue a byte array. I currently have this in a Broker class // consumers is filled with different Thread types all having a queue // variable of type LinkedBlockingQueue ArrayList<Thread> consumers = new ArrayList<Thread>(); synchronized void insert(final byte[] send) throws

How to queue and call actual methods (rather than immediately eval) in java?

﹥>﹥吖頭↗ 提交于 2020-01-04 07:55:40
问题 There are a list of tasks that are time sensitive (but "time" in this case is arbitrary to what another program tells me - it's more like "ticks" rather than time). However, I do NOT want said methods to evaluate immediately. I want one to execute after the other finished. I'm using a linked list for my queue, but I'm not really sure how/if I can access the actual methods in a class without evaluating them immediate. The code would look something like... LinkedList<Method> l = new LinkedList

Is my HelloWorld queue working?

主宰稳场 提交于 2020-01-04 05:59:14
问题 I'm about to put this design into use in an application, but I'm fairly new to threading and Queue stuff in python. Obviously the actual application is not for saying hello, but the design is the same - i.e. there is a process which takes some time to set-up and tear down, but I can do multiple tasks in one hit. Tasks will arrive at random times, and often in bursts. Is this a sensible and thread safe design? class HelloThing(object): def __init__(self): self.queue = self._create_worker() def

Thread Building Blocks concurrent_bounded_queue — how do I «close» it?

有些话、适合烂在心里 提交于 2020-01-04 02:28:12
问题 I am using concurrent_bounded_queue Intel TBB 4.1 Update 3 for communication between producer and consumer threads: concurrent_queue concurrent_bounded_queue The queue class has a method called abort which throws tbb::user_abort to all threads which block on pop and push of the queue instance. The communication between two threads may look like this: ConsThread | ProdThread -----------+------------- q.pop | get new data (wait) | q.push process | get new data q.pop | no more data! (wait) | q

.NET queue ElementAt performance

一曲冷凌霜 提交于 2020-01-03 14:15:12
问题 I'm having a hard time with parts of my code: private void UpdateOutputBuffer() { T[] OutputField = new T[DisplayedLength]; int temp = 0; int Count = HistoryQueue.Count; int Sample = 0; //Then fill the useful part with samples from the queue for (temp = DisplayStart; temp != DisplayStart + DisplayedLength && temp < Count; temp++) { OutputField[Sample++] = HistoryQueue.ElementAt(Count - temp - 1); } DisplayedHistory = OutputField; } It takes most of the time in the program. The number of

Standard queue package for Haskell? [closed]

你离开我真会死。 提交于 2020-01-03 04:22:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Is there a standard queue implementation for Haskell? I see several reasonably mature priority queue implementations, but no simple queues. Data.Sequence seems OK, but I assume we could get better performance with a more restricted datatype. Further, restricting the operations (ie, not a deque) can prevent bugs

Scapy sniff() in a class that subclassess threading.Thread()

风格不统一 提交于 2020-01-03 03:59:07
问题 I've got a strange issue with the Scapy sniff() function. This is how my class is looking: from scapy.all import * import sys import datetime import Queue from threading import Thread class packet_sniffer(Thread): def __init__(self,pass_queue): super(packet_sniffer,self).__init__() print 'Packet sniffer started' self.queue=pass_queue self.device_dict={} self.not_an_ap={} def PacketHandler(self,pkt): if pkt.haslayer(Dot11): sig_str = -(256-ord(pkt.notdecoded[-4:-3])) mac_addr="" ssid="" try: