This is an automated email from the ASF dual-hosted git repository.

eze pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
     new 512cf1e  Add thread yeield to avoid busy waiting in 
LogObject::_checkout_write(). (#7576) (#7906)
512cf1e is described below

commit 512cf1efb4f75ec7a6e69b3cd2d299956fd70454
Author: Walt Karas <[email protected]>
AuthorDate: Tue Jun 1 11:45:14 2021 -0500

    Add thread yeield to avoid busy waiting in LogObject::_checkout_write(). 
(#7576) (#7906)
    
    (cherry picked from commit f278427b1ecdc5ce9e758de51a7faf83bcc58643)
---
 proxy/logging/LogObject.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index 0351005..10dfcc1 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -39,6 +39,7 @@
 
 #include <algorithm>
 #include <vector>
+#include <thread>
 
 static bool
 should_roll_on_time(Log::RollingEnabledValues roll)
@@ -462,7 +463,9 @@ LogObject::_checkout_write(size_t *write_offset, size_t 
bytes_needed)
       break;
 
     case LogBuffer::LB_RETRY:
-      // no more room, but another thread should be taking care of creating a 
new buffer, so try again
+      // no more room, but another thread should be taking care of creating a 
new buffer, so yield to let
+      // the other thread finish, then try again
+      std::this_thread::yield();
       break;
 
     case LogBuffer::LB_BUFFER_TOO_SMALL:

Reply via email to