Skip to content

Commit

Permalink
Do not return when shutdown not finished.Fix a spell error.
Browse files Browse the repository at this point in the history
Signed-off-by: owentou <[email protected]>
  • Loading branch information
owent committed Mar 8, 2022
1 parent bcf6aa0 commit 67963f1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ext/test/http/curl_http_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ TEST_F(BasicCurlHttpTests, SendGetRequestSyncTimeout)
auto result = http_client.Get("http://222.222.222.200:19000/get/", m1);
EXPECT_EQ(result, false);

// When network is under proxy, it may cennect success but closed by peer when send data
// When network is under proxy, it may connect success but closed by peer when send data
EXPECT_TRUE(result.GetSessionState() == http_client::SessionState::ConnectFailed ||
result.GetSessionState() == http_client::SessionState::SendFailed);
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/logs/batch_log_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class BatchLogProcessor : public LogProcessor

/* Synchronization primitives */
std::condition_variable cv_, force_flush_cv_;
std::mutex cv_m_, force_flush_cv_m_;
std::mutex cv_m_, force_flush_cv_m_, shutdown_m_;

/* The buffer/queue to which the ended logs are added */
common::CircularBuffer<Recordable> buffer_;
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/batch_span_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class BatchSpanProcessor : public SpanProcessor

/* Synchronization primitives */
std::condition_variable cv_, force_flush_cv_;
std::mutex cv_m_, force_flush_cv_m_;
std::mutex cv_m_, force_flush_cv_m_, shutdown_m_;

/* The buffer/queue to which the ended spans are added */
common::CircularBuffer<Recordable> buffer_;
Expand Down
1 change: 1 addition & 0 deletions sdk/src/logs/batch_log_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void BatchLogProcessor::DrainQueue()

bool BatchLogProcessor::Shutdown(std::chrono::microseconds timeout) noexcept
{
std::lock_guard<std::mutex> shutdown_guard{shutdown_m_};
bool already_shutdown = is_shutdown_.exchange(true);

if (worker_thread_.joinable())
Expand Down
1 change: 1 addition & 0 deletions sdk/src/trace/batch_span_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void BatchSpanProcessor::DrainQueue()

bool BatchSpanProcessor::Shutdown(std::chrono::microseconds timeout) noexcept
{
std::lock_guard<std::mutex> shutdown_guard{shutdown_m_};
bool already_shutdown = is_shutdown_.exchange(true);

if (worker_thread_.joinable())
Expand Down

0 comments on commit 67963f1

Please sign in to comment.