diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index d00babef40f..2b74cccb072 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -6058,6 +6058,11 @@ static inline HANDLE get_thread_handle_for_extended_context(DWORD tid) { // Thread sampling implementation // void SuspendedThreadTask::internal_do_task() { +#if INCLUDE_JFR + assert(NOT_COMPILER2(true) COMPILER2_PRESENT(!HotCodeHeap) || + SuspendedThreadTask_lock->owned_by_self(), + "suspend/resume must be serialized when HotCodeHeap is enabled"); +#endif const HANDLE h = get_thread_handle_for_extended_context(_thread->osthread()->thread_id()); if (h == nullptr) { return;