Commit 52cbf01
authored
Lock when reading a ConflatedChannel's value. (#3248)
Reads in `isBufferEmpty()` were detected as a race by internal tests.
The relevant stack snippets are:
```
Read of size 4 at 0x0000cf809644 by thread T10 (mutexes: write M0, write M1):
#0 kotlinx.coroutines.channels.ConflatedChannel.isBufferEmpty()Z ConflatedChannel.kt:22
```
and:
```
Previous write of size 4 at 0x0000cf809644 by thread T32 (mutexes: write M2, write M3, write M4, write M5, write M6, write M7):
#0 kotlinx.coroutines.channels.ConflatedChannel.updateValueLocked(Ljava/lang/Object;)Lkotlinx/coroutines/internal/UndeliveredElementException; ConflatedChannel.kt:131
```1 parent 774e66d commit 52cbf01
File tree
1 file changed
+2
-2
lines changed- kotlinx-coroutines-core/common/src/channels
1 file changed
+2
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
0 commit comments