@@ -336,11 +336,24 @@ the device left open but `deviceOpenCount == 0` and no interface claimed. Since
336336releases * claimed* interfaces, that device handle (still registered with the completion port) leaks
337337until process exit.
338338
339- ---
340-
341- ## Open findings
339+ ## 8. Visibility: shared flags are neither volatile nor consistently synchronized — ** FIXED (all platforms)**
340+
341+ > ** Status:** Fixed on 2026-07-06. All three listed items are now ` volatile ` :
342+ > ` WindowsUsbDevice.showAsOpen ` , ` UsbDeviceImpl.connected ` , and the two registry handler fields.
343+ > The same unlocked-` isOpened() ` pattern exists on the other two platforms (the finding named
344+ > Windows only because that's where the review looked) and was fixed there too: ` LinuxUsbDevice.fd `
345+ > and the ` MacosUsbDevice.claimedInterfaces ` reference are also ` volatile ` now (for the latter,
346+ > ` isOpened() ` only null-checks the reference; the list contents are only accessed while holding
347+ > the device monitor, so ` volatile ` on the reference suffices).
348+ >
349+ > In addition, ` emitOnDeviceConnected ` / ` emitOnDeviceDisconnected ` now read the handler field once
350+ > into a local before the null check. With ` volatile ` alone, a concurrent
351+ > ` setOnDeviceConnected(null) ` between the null check and the invocation would have thrown an NPE
352+ > that the catch block then mislabels as an exception * inside* the user's handler.
353+ >
354+ > Compile-verified; pure visibility changes of this kind are not exercisable by the test suite.
342355
343- ## 8. Visibility: shared flags are neither volatile nor consistently synchronized
356+ The original description follows.
344357
345358- ` showAsOpen ` : written under the device monitor, but ` isOpened() ` (` WindowsUsbDevice.java:114 ` )
346359 reads it unlocked — ` checkIsOpen ` /` checkIsClosed ` can act on stale state on a different thread.
@@ -353,6 +366,10 @@ until process exit.
353366All are cheap to fix with ` volatile ` . Practical impact is low (stale reads, not corruption), but
354367` isConnected() ` returning ` true ` long after unplug is user-visible.
355368
369+ ---
370+
371+ ## Open findings
372+
356373## 9. ` messagePort ` (remote) creation is unchecked (macOS)
357374
358375` MacosAsyncTask.java:135 ` : ` CFMessagePortCreateRemote ` can return NULL (e.g. a
@@ -447,9 +464,8 @@ timeout rather than an infinite block).
447464
448465## Recommended priority
449466
450- Findings 1–7 are fixed (see above). Next up: the ` volatile ` flags of finding 8 and the
451- macOS message-port null check of finding 9. Findings 10–12 are low-priority
452- robustness notes.
467+ Findings 1–8 are fixed (see above). Next up: the macOS message-port null check of
468+ finding 9. Findings 10–12 are low-priority robustness notes.
453469
454470The Linux fixes for findings 1–3 still need a hardware test run on a Linux machine, and the
455471finding 7 fix a hardware regression run on Windows.
0 commit comments