Skip to content

Commit 2a0a648

Browse files
committed
update types of SharedMultiprocessingData fields where we rely on concurrency contracts
1 parent 262873f commit 2a0a648

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import java.util.LinkedList;
4747
import java.util.List;
4848
import java.util.Map;
49-
import java.util.SortedMap;
5049
import java.util.WeakHashMap;
5150
import java.util.concurrent.ConcurrentHashMap;
5251
import java.util.concurrent.ConcurrentSkipListMap;
@@ -578,7 +577,7 @@ public static final class SharedMultiprocessingData {
578577
* Maps the two fake file descriptors created in {@link #pipe()} to one
579578
* {@link LinkedBlockingQueue}
580579
*/
581-
private final SortedMap<Integer, LinkedBlockingQueue<Object>> pipeData = new ConcurrentSkipListMap<>();
580+
private final ConcurrentSkipListMap<Integer, LinkedBlockingQueue<Object>> pipeData = new ConcurrentSkipListMap<>();
582581

583582
/**
584583
* Holds ref count of file descriptors which were passed over to a spawned child context.
@@ -588,7 +587,7 @@ public static final class SharedMultiprocessingData {
588587
* <li>real file descriptors coming from the posix implementation</li>
589588
* </ul>
590589
*/
591-
private final Map<Integer, Integer> fdRefCount = new ConcurrentHashMap<>();
590+
private final ConcurrentHashMap<Integer, Integer> fdRefCount = new ConcurrentHashMap<>();
592591

593592
public SharedMultiprocessingData(ConcurrentHashMap<String, Semaphore> namedSemaphores) {
594593
this.namedSemaphores = namedSemaphores;
@@ -691,10 +690,10 @@ public Object takePipeData(Node node, int fd, Runnable noFDHandler) {
691690
}
692691

693692
/**
694-
* This uses LinkedBlockingQueue#compute to determine the blocking state. The runnable may
695-
* be run multiple times, so we need to check and write all possible results to the result
696-
* array. This ensures that if there is concurrent modification of the {@link #pipeData}, we
697-
* will get a valid result.
693+
* This uses {@link ConcurrentSkipListMap#compute} to determine the blocking state. The
694+
* runnable may be run multiple times, so we need to check and write all possible results to
695+
* the result array. This ensures that if there is concurrent modification of the
696+
* {@link #pipeData}, we will get a valid result.
698697
*/
699698
@TruffleBoundary
700699
public boolean isBlocking(int fd) {

0 commit comments

Comments
 (0)