@@ -164,7 +164,6 @@ objectMonitorEnterBlocking(J9VMThread *currentThread)
164164 /* Table entry was created by the nonblocking case, so this peek cannot fail */
165165 Assert_VM_notNull (objectMonitor);
166166 object = NULL ; // for safety, since object may be moved by the GC at various points after this
167- U_64 oldState = 0 ;
168167 /* Ensure object monitor isn't deflated while we block */
169168 omrthread_monitor_t monitor = objectMonitor->monitor ;
170169 VM_AtomicSupport::add (&monitor->pinCount , 1 );
@@ -174,6 +173,8 @@ objectMonitorEnterBlocking(J9VMThread *currentThread)
174173 IDATA waitTime = 1 ;
175174 if (J9_EVENT_IS_HOOKED (vm->hookInterface , J9HOOK_VM_MONITOR_CONTENDED_ENTER)) {
176175 bool frameBuilt = saveBlockingEnterObject (currentThread);
176+ /* Set j.l.Thread status to BLOCKED. */
177+ VM_VMHelpers::setThreadState (currentThread, J9VMTHREAD_STATE_BLOCKED);
177178 VM_VMAccess::setPublicFlags (currentThread, J9_PUBLIC_FLAGS_THREAD_BLOCKED);
178179 ALWAYS_TRIGGER_J9HOOK_VM_MONITOR_CONTENDED_ENTER (vm->hookInterface , currentThread, monitor);
179180 restoreBlockingEnterObject (currentThread, frameBuilt);
@@ -187,7 +188,7 @@ objectMonitorEnterBlocking(J9VMThread *currentThread)
187188 }
188189restart:
189190 /* Set j.l.Thread status to BLOCKED. */
190- oldState = VM_VMHelpers::setThreadState (currentThread, J9VMTHREAD_STATE_BLOCKED);
191+ VM_VMHelpers::setThreadState (currentThread, J9VMTHREAD_STATE_BLOCKED);
191192 internalReleaseVMAccessSetStatus (currentThread, J9_PUBLIC_FLAGS_THREAD_BLOCKED);
192193releasedAccess:
193194 omrthread_monitor_enter_using_threadId (monitor, osThread);
@@ -288,8 +289,8 @@ objectMonitorEnterBlocking(J9VMThread *currentThread)
288289 }
289290done:
290291 clearEventFlag (currentThread, J9_PUBLIC_FLAGS_THREAD_BLOCKED);
291- /* Set j.l.Thread status to oldState . */
292- VM_VMHelpers::setThreadState (currentThread, oldState );
292+ /* Set j.l.Thread status to RUNNING state . */
293+ VM_VMHelpers::setThreadState (currentThread, J9VMTHREAD_STATE_RUNNING );
293294
294295 /* Clear the SUPPRESS_CONTENDED_EXITS bit in the monitor saying that CONTENDED EXIT can be sent again */
295296 ((J9ThreadMonitor*)monitor)->flags &= ~(UDATA)J9THREAD_MONITOR_SUPPRESS_CONTENDED_EXIT;
0 commit comments