mirror of
https://github.com/hyper-neptune/yuuki.git
synced 2024-11-15 19:04:37 +08:00
25 lines
784 B
Python
25 lines
784 B
Python
#!/usr/bin/python3
|
|
# coding=UTF-8
|
|
|
|
import threading, multiprocessing
|
|
|
|
class Yuuki_Thread:
|
|
def __init__(self):
|
|
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_Multiprocess:
|
|
def __init__(self):
|
|
self.dataManager = multiprocessing.Manager()
|
|
|
|
def add(self, Yuuki_Func, args=()):
|
|
added_multiprocess = multiprocessing.Process(name=Yuuki_Func.__name__, target=Yuuki_Func, args=args)
|
|
added_multiprocess.start()
|