This is an automated email from the ASF dual-hosted git repository.
wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new df0fbdc5 Fix ParkingLot::signal does not modify _pending_signal when
there is no waiter (#2916)
df0fbdc5 is described below
commit df0fbdc5d981c98a3f2de027fb940d6bfb7b1911
Author: Bright Chen <[email protected]>
AuthorDate: Sat Mar 15 16:54:44 2025 +0800
Fix ParkingLot::signal does not modify _pending_signal when there is no
waiter (#2916)
---
src/brpc/event_dispatcher.cpp | 1 +
src/bthread/parking_lot.h | 2 +-
src/butil/file_util_posix.cc | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/brpc/event_dispatcher.cpp b/src/brpc/event_dispatcher.cpp
index a8f1b9dc..bbd94684 100644
--- a/src/brpc/event_dispatcher.cpp
+++ b/src/brpc/event_dispatcher.cpp
@@ -51,6 +51,7 @@ static void StopAndJoinGlobalDispatchers() {
delete g_edisp_read_lantency;
delete g_edisp_write_lantency;
}
+
void InitializeGlobalDispatchers() {
g_edisp_read_lantency = new
bvar::LatencyRecorder("event_dispatcher_read_latency");
g_edisp_write_lantency = new
bvar::LatencyRecorder("event_dispatcher_write_latency");
diff --git a/src/bthread/parking_lot.h b/src/bthread/parking_lot.h
index d597c409..9bb48ad7 100644
--- a/src/bthread/parking_lot.h
+++ b/src/bthread/parking_lot.h
@@ -45,10 +45,10 @@ public:
// Wake up at most `num_task' workers.
// Returns #workers woken up.
int signal(int num_task) {
+ _pending_signal.fetch_add((num_task << 1),
butil::memory_order_release);
if (_waiter_num.load(butil::memory_order_relaxed) == 0) {
return 0;
}
- _pending_signal.fetch_add((num_task << 1),
butil::memory_order_release);
return futex_wake_private(&_pending_signal, num_task);
}
diff --git a/src/butil/file_util_posix.cc b/src/butil/file_util_posix.cc
index 3e833363..322e48a0 100644
--- a/src/butil/file_util_posix.cc
+++ b/src/butil/file_util_posix.cc
@@ -601,7 +601,7 @@ bool CreateDirectoryAndGetError(const FilePath& full_path,
if (mkdir(i->value().c_str(), 0755/*others can read the dir*/) == 0)
continue;
// Mkdir failed, but it might have failed with EEXIST, or some other error
- // due to the the directory appearing out of thin air. This can occur if
+ // due to the directory appearing out of thin air. This can occur if
// two processes are trying to create the same file system tree at the same
// time. Check to see if it exists and make sure it is a directory.
int saved_errno = errno;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]