Skip to content

Commit c49f101

Browse files
committed
Remove synchronized from attach/disposeThread
The map is synchronized and it doesn't seem needed otherwise. It was causing a deadlock because of locking order with GIL.
1 parent 9a820a8 commit c49f101

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,7 @@ public void initializeMultiThreading() {
26832683
handler.activateGIL();
26842684
}
26852685

2686-
public synchronized void attachThread(Thread thread, ContextThreadLocal<PythonThreadState> threadState) {
2686+
public void attachThread(Thread thread, ContextThreadLocal<PythonThreadState> threadState) {
26872687
CompilerAsserts.neverPartOfCompilation();
26882688
PythonThreadState pythonThreadState = threadState.get(thread);
26892689
threadStateMapping.put(thread, pythonThreadState);
@@ -2723,7 +2723,7 @@ public void initializeNativeThreadState(PythonThreadState pythonThreadState) {
27232723
}
27242724
}
27252725

2726-
public synchronized void disposeThread(Thread thread, boolean canRunGuestCode) {
2726+
public void disposeThread(Thread thread, boolean canRunGuestCode) {
27272727
CompilerAsserts.neverPartOfCompilation();
27282728
// check if there is a live sentinel lock
27292729
PythonThreadState ts = threadStateMapping.get(thread);

0 commit comments

Comments
 (0)