Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce intermittent test failures in CI by fixing bugs found by asan and tsan #926

Merged
merged 5 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Release/include/cpprest/astreambuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
****/
#pragma once

#include <math.h>
#include <atomic>
#include <cstring>
#include <ios>
#include <memory>
#include <cstring>
#include <math.h>

#include "pplx/pplxtasks.h"
#include "cpprest/details/basic_types.h"
Expand Down Expand Up @@ -745,7 +746,10 @@ namespace streams

std::exception_ptr m_currentException;
// The in/out mode for the buffer
bool m_stream_can_read, m_stream_can_write, m_stream_read_eof, m_alloced;
std::atomic<bool> m_stream_can_read;
std::atomic<bool> m_stream_can_write;
std::atomic<bool> m_stream_read_eof;
std::atomic<bool> m_alloced;


private:
Expand Down Expand Up @@ -1208,5 +1212,3 @@ namespace streams
};

}}


13 changes: 7 additions & 6 deletions Release/include/pplx/pplxlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#else
#include <mutex>
#include <mutex>
#include <atomic>
#include <condition_variable>
#endif

Expand Down Expand Up @@ -80,7 +81,7 @@ namespace platform
static const unsigned int timeout_infinite = 0xFFFFFFFF;

event_impl()
: _signaled(false)
: _signaled(false)
{
}

Expand Down Expand Up @@ -209,7 +210,7 @@ namespace platform
_M_cs.lock();
_M_owner = id;
_M_recursionCount = 1;
}
}
}

void unlock()
Expand All @@ -223,12 +224,12 @@ namespace platform
{
_M_owner = -1;
_M_cs.unlock();
}
}
}

private:
cpprest_synchronization::mutex _M_cs;
volatile long _M_owner;
std::atomic<long> _M_owner;
long _M_recursionCount;
};

Expand Down Expand Up @@ -298,7 +299,7 @@ namespace extensibility
#else
typedef details::linux_scheduler default_scheduler_t;
#endif

namespace details
{
/// <summary>
Expand Down
Loading