2019-08-22 18:33:10 +08:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# coding=UTF-8
|
|
|
|
|
2019-08-31 12:36:18 +08:00
|
|
|
import threading, multiprocessing
|
2019-08-23 18:12:41 +08:00
|
|
|
|
|
|
|
class Yuuki_Thread:
|
2019-08-22 18:33:10 +08:00
|
|
|
def __init__(self):
|
2019-08-31 12:36:18 +08:00
|
|
|
self.lock = threading.Lock()
|
|
|
|
|
|
|
|
def add(self, Yuuki_Func, args=()):
|
|
|
|
added_thread = threading.Thread(name=Yuuki_Func.__name__, target=Yuuki_Func, args=args)
|
|
|
|
added_thread.start()
|
|
|
|
|
|
|
|
def getThreadInfo(self):
|
|
|
|
print(threading.active_count())
|
|
|
|
print(threading.enumerate())
|
|
|
|
print("{} add Threading\n".format(threading.current_thread()))
|
|
|
|
|
|
|
|
class Yuuki_MultiPross:
|
|
|
|
def add(self, Yuuki_Func, args=()):
|
|
|
|
added_multiprocess = multiprocessing.Process(name=Yuuki_Func.__name__, target=Yuuki_Func, args=args)
|
|
|
|
added_multiprocess.start()
|