MCPcopy Create free account
hub / github.com/FastLED/FastLED / serverThreadFunc

Function serverThreadFunc

tests/fl/stl/asio/http/test_utils/server_thread.cpp.hpp:20–31  ·  view source on GitHub ↗

Static thread function that captures shared_ptr to data, not raw `this`

Source from the content-addressed store, hash-verified

18
19// Static thread function that captures shared_ptr to data, not raw `this`
20static void serverThreadFunc(fl::shared_ptr<ServerThreadData> data) {
21 while (data->mRunning.load()) {
22 // Accept new clients (non-blocking)
23 // NOTE: Do NOT call update() here - the test's main thread handles
24 // data I/O via update()/readRequest(). Calling update() from both
25 // threads causes concurrent socket reads that corrupt chunked encoding.
26 data->mServer->acceptClients();
27
28 // Small sleep to prevent CPU spinning
29 fl::this_thread::sleep_for(fl::chrono::milliseconds(10)); // ok sleep for
30 }
31}
32
33ServerThread::ServerThread(fl::shared_ptr<fl::net::http::HttpStreamServer> server) {
34 mData = fl::make_shared<ServerThreadData>();

Callers

nothing calls this directly

Calls 3

sleep_forFunction · 0.50
loadMethod · 0.45
acceptClientsMethod · 0.45

Tested by

no test coverage detected