Skip to content

Commit 930b5cf

Browse files
committed
avoid busy waiting in HPy reference cleanup thread
1 parent b2b7484 commit 930b5cf

File tree

1 file changed

+2
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy

1 file changed

+2
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,14 +927,15 @@ public void run() {
927927
* thread).
928928
*/
929929
GraalHPyHandleReference refList;
930+
int retries = 0;
930931
do {
931932
/*
932933
* If 'refList' is null then the main is currently updating it. So, we need
933934
* to repeat until we get something. The written empty list will just be
934935
* lost.
935936
*/
936937
refList = hPyContext.references.getAndSet(null);
937-
} while (refList == null);
938+
} while (refList == null && retries++ < 3);
938939

939940
if (!refs.isEmpty()) {
940941
try {

0 commit comments

Comments
 (0)