On Tue, 8 Sep 2026 10:17:24 GMT, Quan Anh Mai <[email protected]> wrote:

>> test/jdk/java/foreign/detachafterexit/libDetachAfterExit.cpp line 30:
>> 
>>> 28: 
>>> 29: static TestThread THREAD;
>>> 30: static volatile bool FLAG = false;
>> 
>> My C++ is really rusty, but I think `volatile` is much weaker in C++ 
>> compared to Java, so I wonder if there is actually any inter-thread 
>> synchronization going on here or if we need to use something stronger like 
>> `std::atomic<bool> FLAG(false); `?
>
> Yeah, racy access is UB, so we need atomic.

Thanks, changed this to use `std::atomic` (unfortunately 
`std::binary_semaphore` is C++20)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32686#discussion_r3960024955

Reply via email to