Skip to content

Commit

Permalink
src/io.cpp: Fix uninitialized variable.
Browse files Browse the repository at this point in the history
`std::atomic<bool>` does not default initialize to `false`.

Bug: google#12
  • Loading branch information
ben-clayton committed Jan 17, 2020
1 parent e4fc3df commit 53e00a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class File : public dap::ReaderWriter {
out[i] = char(c);
}
return n;
// return fread(buffer, 1, n, f);
}
bool write(const void* buffer, size_t n) override {
std::unique_lock<std::mutex> lock(writeMutex);
Expand All @@ -143,10 +142,10 @@ class File : public dap::ReaderWriter {

private:
FILE* const f;
const bool closable;
std::mutex readMutex;
std::mutex writeMutex;
std::atomic<bool> closed;
const bool closable;
std::atomic<bool> closed = { false };
};

class ReaderSpy : public dap::Reader {
Expand Down

0 comments on commit 53e00a2

Please sign in to comment.