mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-07-29 03:58:29 -06:00
Removed the Requirement to Install Python and NodeJS (Now Bundled with Borealis)
This commit is contained in:
38
Dependencies/Python/Lib/test/test_importlib/partial/cfimport.py
vendored
Normal file
38
Dependencies/Python/Lib/test/test_importlib/partial/cfimport.py
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
|
||||
NLOOPS = 50
|
||||
NTHREADS = 30
|
||||
|
||||
|
||||
def t1():
|
||||
try:
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
os._exit(1)
|
||||
|
||||
def t2():
|
||||
try:
|
||||
from concurrent.futures.thread import ThreadPoolExecutor
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
os._exit(1)
|
||||
|
||||
def main():
|
||||
for j in range(NLOOPS):
|
||||
threads = []
|
||||
for i in range(NTHREADS):
|
||||
threads.append(threading.Thread(target=t2 if i % 1 else t1))
|
||||
for thread in threads:
|
||||
thread.start()
|
||||
for thread in threads:
|
||||
thread.join()
|
||||
sys.modules.pop('concurrent.futures', None)
|
||||
sys.modules.pop('concurrent.futures.thread', None)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
27
Dependencies/Python/Lib/test/test_importlib/partial/pool_in_threads.py
vendored
Normal file
27
Dependencies/Python/Lib/test/test_importlib/partial/pool_in_threads.py
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import multiprocessing
|
||||
import os
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
|
||||
def t():
|
||||
try:
|
||||
with multiprocessing.Pool(1):
|
||||
pass
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
os._exit(1)
|
||||
|
||||
|
||||
def main():
|
||||
threads = []
|
||||
for i in range(20):
|
||||
threads.append(threading.Thread(target=t))
|
||||
for thread in threads:
|
||||
thread.start()
|
||||
for thread in threads:
|
||||
thread.join()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user