Skip to content

Commit 975ac71

Browse files
committed
Remove extraneous thread and busy loop
1 parent 444abe6 commit 975ac71

File tree

1 file changed

+7
-15
lines changed
  • ext/test/w3c_tracecontext_test

1 file changed

+7
-15
lines changed

ext/test/w3c_tracecontext_test/main.cc

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,23 @@
33

44
#include <stdint.h>
55
#include <stdlib.h>
6-
#include <algorithm>
7-
#include <initializer_list>
86
#include <iostream>
97
#include <map>
108
#include <nlohmann/json.hpp>
119
#include <string>
1210
#include <utility>
1311
#include <vector>
1412

15-
#include "opentelemetry/context/context_value.h"
1613
#include "opentelemetry/context/propagation/text_map_propagator.h"
1714
#include "opentelemetry/context/runtime_context.h"
1815
#include "opentelemetry/exporters/ostream/span_exporter.h"
1916
#include "opentelemetry/ext/http/client/curl/http_client_curl.h"
20-
#include "opentelemetry/ext/http/client/curl/http_operation_curl.h"
2117
#include "opentelemetry/ext/http/client/http_client.h"
2218
#include "opentelemetry/ext/http/server/http_server.h"
2319
#include "opentelemetry/nostd/shared_ptr.h"
2420
#include "opentelemetry/nostd/string_view.h"
2521
#include "opentelemetry/sdk/trace/exporter.h"
2622
#include "opentelemetry/sdk/trace/processor.h"
27-
#include "opentelemetry/sdk/trace/recordable.h"
2823
#include "opentelemetry/sdk/trace/simple_processor.h"
2924
#include "opentelemetry/sdk/trace/tracer_context.h"
3025
#include "opentelemetry/sdk/trace/tracer_provider.h"
@@ -243,14 +238,11 @@ int main(int argc, char *argv[])
243238
std::cout << "Listening at http://" << default_host << ":" << port << "/test\n";
244239

245240
// Wait for signal to stop server
246-
std::thread server_check([&stop_server, &server]() {
247-
while (!stop_server.load())
248-
{
249-
// keep running the thread
250-
}
251-
// received signal to stop server
252-
std::cout << "stopping server \n";
253-
server.stop();
254-
});
255-
server_check.join();
241+
while (!stop_server.load())
242+
{
243+
std::this_thread::sleep_for(std::chrono::seconds(1));
244+
}
245+
// received signal to stop server
246+
std::cout << "Stopping server \n";
247+
server.stop();
256248
}

0 commit comments

Comments
 (0)