mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-17 23:52:46 +01:00
No one's using this WorkQueue crap; I didn't really mean for it to be committed.
This commit is contained in:
parent
9d3f572b71
commit
6dd8693daa
@ -349,29 +349,4 @@ class TwoWayDictionary(dict):
|
||||
dict.__delitem__(self, value)
|
||||
|
||||
|
||||
class WorkQueue(object):
|
||||
def __init__(self, q=None, n=1):
|
||||
if q is None:
|
||||
q = Queue.Queue()
|
||||
self.q = q
|
||||
self.numberOfThreads = n
|
||||
self.threads = []
|
||||
for _ in xrange(n):
|
||||
t = threading.Thread(target=self.target)
|
||||
self.threads.append(t)
|
||||
t.start()
|
||||
|
||||
def target(self):
|
||||
while 1:
|
||||
f = self.q.get()
|
||||
if f is None:
|
||||
self.q.put(None)
|
||||
break
|
||||
else:
|
||||
f()
|
||||
|
||||
def enqueue(self, f):
|
||||
self.q.put(f)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user