Commit 96b25aaf by Ben Clayton Committed by Ben Clayton

src/io.cpp: Fix uninitialized variable.

`std::atomic<bool>` does not default initialize to `false`. Bug: #12
parent 93b86100
...@@ -130,7 +130,6 @@ class File : public dap::ReaderWriter { ...@@ -130,7 +130,6 @@ class File : public dap::ReaderWriter {
out[i] = char(c); out[i] = char(c);
} }
return n; return n;
// return fread(buffer, 1, n, f);
} }
bool write(const void* buffer, size_t n) override { bool write(const void* buffer, size_t n) override {
std::unique_lock<std::mutex> lock(writeMutex); std::unique_lock<std::mutex> lock(writeMutex);
...@@ -143,10 +142,10 @@ class File : public dap::ReaderWriter { ...@@ -143,10 +142,10 @@ class File : public dap::ReaderWriter {
private: private:
FILE* const f; FILE* const f;
const bool closable;
std::mutex readMutex; std::mutex readMutex;
std::mutex writeMutex; std::mutex writeMutex;
std::atomic<bool> closed; std::atomic<bool> closed = { false };
const bool closable;
}; };
class ReaderSpy : public dap::Reader { class ReaderSpy : public dap::Reader {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment