2019-08-22 18:33:10 +08:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# coding=UTF-8
|
|
|
|
|
2019-12-25 21:35:43 +08:00
|
|
|
import multiprocessing
|
|
|
|
import threading
|
|
|
|
|
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()))
|
|
|
|
|
2019-12-25 21:35:43 +08:00
|
|
|
|
2019-10-11 21:43:05 +08:00
|
|
|
class Yuuki_Multiprocess:
|
2019-08-31 12:36:18 +08:00
|
|
|
def add(self, Yuuki_Func, args=()):
|
|
|
|
added_multiprocess = multiprocessing.Process(name=Yuuki_Func.__name__, target=Yuuki_Func, args=args)
|
|
|
|
added_multiprocess.start()
|