Created
June 13, 2020 17:43
-
-
Save paulwinex/c6ee848bed5f8c96b83c26ffdf6a3882 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from concurrent.futures import ProcessPoolExecutor | |
import multiprocessing | |
def infinite_compute(a): | |
print('Core', a) | |
while True: | |
x = 2 * 2 | |
print('Ctrl+C to exit') | |
try: | |
with ProcessPoolExecutor() as executor: | |
executor.map(infinite_compute, list(range(multiprocessing.cpu_count()))) | |
except KeyboardInterrupt: | |
exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment