ThreadComponent is a small C++17 networking and concurrency toolkit from Hotbits. It collects reusable worker, queue, container, TCP, HTTP, and HTTPS components that are designed to be practical in service-style applications and easy to embed in larger projects.
The current focus is the V2 API set:
cBaseWorker_V2for cooperative background workerscThreadQueue_V2for simple thread-safe queued handoffsimple_container_V2for thread-safe sequence-style bufferingTCPClient_V2,TCPServer_V2, andcTCPSyncClient_V2for TCP client/server use casescHTTPServer_V2andcHTTPSServer_V2for Simple-Web-Server based HTTP servicescHTTPClientfor outbound HTTP requests with libcurl
Legacy headers are still present for compatibility, but the maintained examples and build targets are centered on the V2 classes and the currently self-contained components.
- C++17 compiler
- CMake 3.16+
- OpenSSL development package
- libcurl development package
- POSIX-style sockets environment
- tested shape is macOS/Linux
- The sibling
OpenSourcedependency tree expected by this project:OpenSource/Simple-Web-ServerOpenSource/asio/asio-1.36.0/includeOpenSource/gzip/gzip-hpp-0.1.0/includeOpenSource/json/rapidjson-1.1.0/include
By default the root CMakeLists.txt assumes this folder lives under:
<repo>/Software/ThreadComponent
and that dependencies live under:
<repo>/OpenSource
If your checkout layout is different, pass THREADCOMPONENT_REPOSITORY_ROOT or THREADCOMPONENT_OPENSOURCE_DIR to CMake.
From the project root:
cmake -S . -B build
cmake --build buildIf the OpenSource folder is somewhere else:
cmake -S . -B build -DTHREADCOMPONENT_OPENSOURCE_DIR=/path/to/OpenSource
cmake --build buildExample binaries are written to:
build/bin/
The curated examples built by CMake are:
baseWorkerExample_V2.binthreadQueueExample_V2.binsimpleContainerExample_V2.binclientTest_V2.binserverTest_V2.bintcpSyncClientExample_V2.binhttpClientExample.binhttpServerTest.binhttpServerTest_V2.binhttpsServerTest.binhttpsServerTest_V2.bin
The HTTPS examples use the sample certificate files in examples/certs/.
Examples are intentionally small and self-contained:
baseWorkerExample_V2.bin- starts a derived worker, emits heartbeat updates, then stops cleanly
threadQueueExample_V2.bin- shows producer/consumer style queue handoff
simpleContainerExample_V2.bin- demonstrates batch insert, timed grab, and snapshot usage
serverTest_V2.bin- starts a TCP server on port
8080
- starts a TCP server on port
clientTest_V2.bin- connects to
127.0.0.1:8080and sends interactive messages
- connects to
tcpSyncClientExample_V2.bin- performs one synchronous TCP request/response exchange
httpClientExample.bin- sends an outbound HTTP request with
cHTTPClient
- sends an outbound HTTP request with
httpServerTest.binandhttpServerTest_V2.bin- start HTTP servers with
/healthand/echoroutes
- start HTTP servers with
httpsServerTest.binandhttpsServerTest_V2.bin- start HTTPS servers with the bundled demo certificate
The examples/README.md file describes each example in a little more detail.
cBaseWorker_V2.h- RAII-oriented worker thread base class
cThreadQueue_V2.h- thread-safe queue wrapper
simple_container_V2.h- thread-safe sequence container
cTCPClient_V2.h- asynchronous TCP client
cTCPServer_V2.h- asynchronous TCP server
cTCPSyncClient_V2.h- synchronous request/response TCP client
cHTTPClient.h/cHTTPClient.cpp- libcurl-backed HTTP client
cHTTPServer*.h/.cpp- HTTP server wrappers
cHTTPSServer*.h/.cpp- HTTPS server wrappers
examples/- runnable sample programs and TLS demo certs
- Not every legacy source file in this folder is built by default.
- The old
clientTest.cpp,serverTest.cpp, andcTestSimpleContainer.cppare retained as reference material, but the supported example set is the curated one wired intoexamples/CMakeLists.txt. - This project currently targets POSIX networking APIs. Windows support would need additional socket abstraction work.
This project is licensed under the GNU GPL v3.0. See LICENSE.
Third-party libraries and headers keep their own licenses.