src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp
changeset 59252 623722a6aeb9
parent 59251 4cbfa5077d68
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
    85 void JfrPostBox::deposit(int new_messages) {
    85 void JfrPostBox::deposit(int new_messages) {
    86   while (true) {
    86   while (true) {
    87     const int current_msgs = Atomic::load(&_messages);
    87     const int current_msgs = Atomic::load(&_messages);
    88     // OR the new message
    88     // OR the new message
    89     const int exchange_value = current_msgs | new_messages;
    89     const int exchange_value = current_msgs | new_messages;
    90     const int result = Atomic::cmpxchg(exchange_value, &_messages, current_msgs);
    90     const int result = Atomic::cmpxchg(&_messages, current_msgs, exchange_value);
    91     if (result == current_msgs) {
    91     if (result == current_msgs) {
    92       return;
    92       return;
    93     }
    93     }
    94     /* Some other thread just set exactly what this thread wanted */
    94     /* Some other thread just set exactly what this thread wanted */
    95     if ((result & new_messages) == new_messages) {
    95     if ((result & new_messages) == new_messages) {