mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +02:00
Make request progress variables atomic
These are the only bit of shared state between the Request user thread and RequestManager that aren't covered by RequestHandle::stateMx. The problem was that they were not covered by anything, which meant that they were not guaranteed to be coherent between threads.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "common/ExplicitSingleton.h"
|
||||
#include "common/String.h"
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -36,8 +37,8 @@ namespace http
|
||||
State state = ready;
|
||||
std::mutex stateMx;
|
||||
std::condition_variable stateCv;
|
||||
int bytesTotal = 0;
|
||||
int bytesDone = 0;
|
||||
std::atomic<int> bytesTotal = 0;
|
||||
std::atomic<int> bytesDone = 0;
|
||||
int statusCode = 0;
|
||||
ByteString responseData;
|
||||
std::vector<ByteString> responseHeaders;
|
||||
|
Reference in New Issue
Block a user