Mercurial > minori
diff include/core/http.h @ 390:2d3e10319112
http: optimize HTTP request thread
we don't need a mutex at all, in fact all we need is an atomic
boolean to signify whether the thread is cancelled.
curl options are now for the most part handled by a separate
function to keep them in sync between non-threaded and threaded
implementations
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 07 Nov 2025 07:08:57 -0500 |
| parents | 1e5d922fe82b |
| children | 963047512d34 |
line wrap: on
line diff
--- a/include/core/http.h Thu Nov 06 12:21:35 2025 -0500 +++ b/include/core/http.h Fri Nov 07 07:08:57 2025 -0500 @@ -7,6 +7,7 @@ #include <mutex> #include <string> #include <vector> +#include <atomic> namespace HTTP { @@ -52,13 +53,11 @@ std::string data_; std::vector<std::string> headers_; Type type_; + void *curl_; /* these are passed to the write callback */ QByteArray array_; - bool cancelled_ = false; - - /* don't fuck this up */ - std::mutex callback_data_mutex_; + std::atomic<bool> cancelled_ = false; }; } // namespace HTTP
