Last active
April 8, 2026 19:41
-
-
Save carl-mastrangelo/e83d639e116a15092b9293f7d970501f 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 ThreadPoolExecutor | |
| count = 0 | |
| with ThreadPoolExecutor(max_workers=3) as executor: | |
| def inc(): | |
| global count | |
| for i in range(10_000_000): | |
| count = count + 1 | |
| executor.submit(inc) | |
| executor.submit(inc) | |
| executor.submit(inc) | |
| print(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment