On Thu, 2 May 2024 21:00:52 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> src/jdk.jdwp.agent/share/native/libjdwp/util.c line 1204: >> >>> 1202: // Need to lock during initialization so verifyMonitorRank() can >>> be guaranteed that >>> 1203: // if the monitor field is set, then the monitor if fully >>> initialized. More specifically, >>> 1204: // that the rank field has been set. >> >> rank for all monitors can be set in `util_initialize()`: >> >> for (i = 0; i < NUM_DEBUG_RAW_MONITORS; i++) { >> dbg_monitors[i]->rank = i; >> } > > Ok. I decided not to make this change. It was a bit disruptive with the need for forward declarations. Plus I wasn't convinced I wouldn't still need the locking since there is also the assignment of the name field (although that is only used if something has gone wrong) and also I was a little worried that tearing could happen on some platforms (a partial ptr value is read in), although not on any platform that we support. I did update the comment to make it less specific about the rank field. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19044#discussion_r1591571349