Skip to content

Commit 32cf833

Browse files
committed
Make threading in graalpytest compatible for CPython.
1 parent 050c572 commit 32cf833

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

graalpython/com.oracle.graal.python.test/src/graalpytest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ class ThreadPool():
6060
if os.environ.get(b"ENABLE_THREADED_GRAALPYTEST") == b"true":
6161
maxcnt = min(os.cpu_count(), 16)
6262
sleep = time.sleep
63+
start_new_thread = _thread.start_new_thread
6364
print("Running with %d threads" % maxcnt)
6465
else:
6566
sleep = lambda x: x
67+
start_new_thread = lambda f, args: f(*args)
6668
maxcnt = 1
6769

6870
@classmethod
@@ -73,7 +75,7 @@ def runner():
7375
function()
7476
finally:
7577
self.release_token()
76-
_thread.start_new_thread(runner, ())
78+
self.start_new_thread(runner, ())
7779
self.sleep(0.5)
7880

7981
@classmethod

0 commit comments

Comments
 (0)