from concurrent.futures import ThreadPoolExecutor
import pyopenjtalk
label = pyopenjtalk.extract_fullcontext(text)
with ThreadPoolExecutor() as e:
futures = [e.submit(ojt.synthesize, label) for i in range(32)]
results = [i.result() for i in futures]
first = results[0]
for i, j in results[1:-1]:
assert np.allclose(first[0], i)
assert first[1] == j
print("synthesize() done")
To prevent this, a mutex is required for the functions that accesses _global_htsengine.
There should also be mutexes for other global objects.
NOTE: This problem becomes worse if we add code that releases the GIL.
The following code causes a segmentation fault:
To prevent this, a mutex is required for the functions that accesses _global_htsengine.
There should also be mutexes for other global objects.
NOTE: This problem becomes worse if we add code that releases the GIL.