pep.py/objects/logThread.py
2016-07-31 11:11:33 +02:00

25 lines
524 B
Python

'''
import threading
class task:
def __init__(self, function, args = (), kwargs = {}):
self.function = function
self.args = args
self.kwargs = kwargs
class logThread:
def __init__(self):
self.thread = threading.Thread()
self.queue = []
def enqueue(self, function, args = (), kwargs = {}):
self.queue.append(task(function, args, kwargs))
def run(self):
for i in self.queue:
self.thread = threading.Thread(i.function, i.args, i.kwargs)
self.thread.run()
self.thread.join()
self.queue = []
'''