#pragma once
#include <assert.h>
#include <errno.h>
#include <atomic>
#include <functional>
#include <list>
#include <mutex>
#include <queue>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <glog/logging.h>
#include <folly/ScopeGuard.h>
#include <folly/concurrency/CacheLocality.h>
#include <folly/detail/Futex.h>
#include <folly/lang/CustomizationPoint.h>
#include <folly/synchronization/AtomicNotification.h>
#include <folly/synchronization/detail/AtomicUtils.h>
#include <folly/synchronization/test/Semaphore.h>
namespace folly {
namespace test {
#define FOLLY_TEST_DSCHED_VLOG(...) …
AuxAct;
AuxChk;
struct DSchedThreadId { … };
class DSchedTimestamp { … };
class ThreadTimestamps { … };
struct ThreadInfo { … };
class ThreadSyncVar { … };
class DeterministicSchedule { … };
template <
typename T,
typename Schedule = DeterministicSchedule,
template <typename> class Atom = std::atomic>
struct DeterministicAtomicImpl { … };
DeterministicAtomic;
int futexWakeImpl(
const detail::Futex<test::DeterministicAtomic>* futex,
int count,
uint32_t wakeMask);
detail::FutexResult futexWaitImpl(
const detail::Futex<test::DeterministicAtomic>* futex,
uint32_t expected,
std::chrono::system_clock::time_point const* absSystemTime,
std::chrono::steady_clock::time_point const* absSteadyTime,
uint32_t waitMask);
template <template <typename> class Atom>
int deterministicFutexWakeImpl(
const detail::Futex<Atom>* futex,
std::mutex& futexLock,
std::unordered_map<
const detail::Futex<Atom>*,
std::list<std::pair<uint32_t, bool*>>>& futexQueues,
int count,
uint32_t wakeMask) { … }
template <template <typename> class Atom>
detail::FutexResult deterministicFutexWaitImpl(
const detail::Futex<Atom>* futex,
std::mutex& futexLock,
std::unordered_map<
const detail::Futex<Atom>*,
std::list<std::pair<uint32_t, bool*>>>& futexQueues,
uint32_t expected,
std::chrono::system_clock::time_point const* absSystemTimeout,
std::chrono::steady_clock::time_point const* absSteadyTimeout,
uint32_t waitMask) { … }
template <typename Integer>
void tag_invoke(
cpo_t<atomic_wait>, const DeterministicAtomic<Integer>*, Integer) { … }
template <typename Integer, typename Clock, typename Duration>
std::cv_status tag_invoke(
cpo_t<atomic_wait_until>,
const DeterministicAtomic<Integer>*,
Integer,
const std::chrono::time_point<Clock, Duration>&) { … }
template <typename Integer>
void tag_invoke(cpo_t<atomic_notify_one>, const DeterministicAtomic<Integer>*) { … }
template <typename Integer>
void tag_invoke(cpo_t<atomic_notify_all>, const DeterministicAtomic<Integer>*) { … }
struct DeterministicMutex { … };
}
template <>
Getcpu::Func AccessSpreader<test::DeterministicAtomic>::pickGetcpuFunc();
}