|
|
|
@ -29,48 +29,9 @@ namespace llarp
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// a condition variable that does nothing
|
|
|
|
|
struct NullCondition
|
|
|
|
|
{
|
|
|
|
|
template < typename Lock_t >
|
|
|
|
|
void
|
|
|
|
|
wait(Lock_t& l)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template < typename Lock_t, typename Pred >
|
|
|
|
|
void
|
|
|
|
|
wait(Lock_t& l, Pred p)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
notify_one()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
notify_all()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template < typename Interval >
|
|
|
|
|
void
|
|
|
|
|
wait_for(NullLock& l, Interval i)
|
|
|
|
|
{
|
|
|
|
|
std::this_thread::sleep_for(i);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef SHADOW_TESTNET
|
|
|
|
|
typedef NullMutex mtx_t;
|
|
|
|
|
typedef NullLock lock_t;
|
|
|
|
|
typedef NullCondition cond_t;
|
|
|
|
|
#else
|
|
|
|
|
typedef std::mutex mtx_t;
|
|
|
|
|
typedef std::unique_lock< std::mutex > lock_t;
|
|
|
|
|
typedef std::condition_variable cond_t;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct Mutex
|
|
|
|
|
{
|
|
|
|
|