Multiple changes:

- Move to a Python process for the LanguageLink client [fixes #1, presumably]
- Finish a first rough draft of the booklet [fixes #4]
This commit is contained in:
2022-06-11 18:43:17 +02:00
parent acded68da5
commit 6369d15e93
39 changed files with 3977 additions and 56 deletions

View File

@@ -0,0 +1,36 @@
import argparse
import threading
import time
# Calculate the factorial
def factorial(n, t):
time.sleep(n*t/4)
print("Start: " + str(t) + ": " + str(n))
if n == 1:
res = 1
if t == 1:
print("Feel free to break here")
else:
res = n * factorial(n-1, t)
return res
# Calculate the factorial and print the result
def factorial_thread(n, t):
time.sleep(2)
result = factorial(n, t)
print("Thread " + str(t) + " = "+str(result))
def launch_factorials(n):
threads = []
print("Calculate: "+str(n))
breakpoint()
for i in range(n):
threads.append(threading.Thread(target=factorial_thread, args=(n+i, i+1)))
threads[-1].start()
print("Wait for the results")
for thread in threads:
thread.join()
print("Done")