src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp
changeset 54645 05aaccf7d558
parent 54623 1126f0607c70
child 57360 5d043a159d5c
child 58863 c16ac7a2eba4
equal deleted inserted replaced
54644:8d52b4c6f9d8 54645:05aaccf7d558
   108 }
   108 }
   109 
   109 
   110 void JfrPostBox::synchronous_post(int msg) {
   110 void JfrPostBox::synchronous_post(int msg) {
   111   assert(is_synchronous(msg), "invariant");
   111   assert(is_synchronous(msg), "invariant");
   112   assert(!JfrMsg_lock->owned_by_self(), "should not hold JfrMsg_lock here!");
   112   assert(!JfrMsg_lock->owned_by_self(), "should not hold JfrMsg_lock here!");
   113   MutexLocker msg_lock(JfrMsg_lock);
   113   MonitorLocker msg_lock(JfrMsg_lock);
   114   deposit(msg);
   114   deposit(msg);
   115   // serial_id is used to check when what we send in has been processed.
   115   // serial_id is used to check when what we send in has been processed.
   116   // _msg_read_serial is read under JfrMsg_lock protection.
   116   // _msg_read_serial is read under JfrMsg_lock protection.
   117   const uintptr_t serial_id = OrderAccess::load_acquire(&_msg_read_serial) + 1;
   117   const uintptr_t serial_id = OrderAccess::load_acquire(&_msg_read_serial) + 1;
   118   JfrMsg_lock->notify_all();
   118   msg_lock.notify_all();
   119   while (!is_message_processed(serial_id)) {
   119   while (!is_message_processed(serial_id)) {
   120     JfrMsg_lock->wait();
   120     msg_lock.wait();
   121   }
   121   }
   122 }
   122 }
   123 
   123 
   124 /*
   124 /*
   125  * Check if a synchronous message has been processed.
   125  * Check if a synchronous message has been processed.