Last active
September 24, 2019 11:35
-
-
Save mayurbhangale/2b7d7323d78291f23d5f304a16f34bf4 to your computer and use it in GitHub Desktop.
Kills ants stuck inside your laptop
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 multiprocessing import Pool | |
| from multiprocessing import cpu_count | |
| def f(x): | |
| while True: | |
| x*x | |
| if __name__ == '__main__': | |
| processes = cpu_count() | |
| pool = Pool(processes) | |
| pool.map(f, range(processes)) | |
| #stop gracefully when you're done fighting with ants |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment