From 3dd333269e55021848251edcf47927a3b8afd841 Mon Sep 17 00:00:00 2001 From: Robinson Date: Sat, 11 Jun 2022 22:36:23 +0200 Subject: [PATCH] Response waiter is now volatile, as it's data is used by DIFFERENT coroutines. --- src/dorkbox/network/rmi/ResponseWaiter.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dorkbox/network/rmi/ResponseWaiter.kt b/src/dorkbox/network/rmi/ResponseWaiter.kt index 3674bdb3..8aabc70d 100644 --- a/src/dorkbox/network/rmi/ResponseWaiter.kt +++ b/src/dorkbox/network/rmi/ResponseWaiter.kt @@ -27,10 +27,14 @@ data class ResponseWaiter(val id: Int) { // "send" suspends until another coroutine invokes "receive". // // these are wrapped in a try/catch, because cancel will cause exceptions to be thrown (which we DO NOT want) + @Volatile var channel: Channel = Channel(Channel.RENDEZVOUS) + + @Volatile var isCancelled = false // holds the RMI result or callback. This is ALWAYS accessed from within a lock (so no synchronize/volatile/etc necessary)! + @Volatile var result: Any? = null /**