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:
parent
b7a6663e08
commit
85d492bad6
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user