namespace axl::sys

namespace sys {

// namespaces

namespace axl::sys::drw;
namespace axl::sys::lnx;
namespace axl::sys::psx;
namespace axl::sys::win;

// typedefs

typedef EventBase<sl::False<bool>> Event;
typedef EventBase<sl::True<bool>> NotificationEvent;
typedef NameableEventBase<sl::False<bool>> NameableEvent;
typedef NameableEventBase<sl::True<bool>> NameableNotificationEvent;
typedef rc::Ptr<void> TlsValue;

// structs

struct SjljFrame;
struct Time;

// classes

class InvertedSemaphore;
class ReadWriteLock;
class ScopeLock;

template <typename T>
class ScopedTlsPtrSlot;

class TlsMgr;

template <typename T>
class TlsPtrSlot;

class TlsSlot;

// global functions

void
atomicUpdatePeak(
    volatile int32_t* peak,
    int32_t current
    );

void
yieldProcessor();

void
atomicLock(volatile int32_t* lock);

void
atomicUnlock(volatile int32_t* lock);

uint_t
getCurrentProcessId();

bool
createProcess(const sl::StringRef& commandLine);

sl::String
getProcessImageName(uint_t pid);

void
sjljThrow();

uint64_t
getTimestamp();

uint64_t
getPreciseTimestamp();

void
sleep(uint32_t msCount);

int
getTimeZoneOffsetInMinutes(int timeZone);

uint64_t
getTimestampFromTimeval(const timeval* tval);

TlsMgr*
getTlsMgr();

size_t
createSimpleTlsSlot();

bool
deleteSimpleTlsSlot(size_t slot);

intptr_t
getSimpleTlsValue(size_t slot);

intptr_t
setSimpleTlsValue(
    size_t slot,
    intptr_t value
    );

template <typename T>
T*
getTlsPtrSlotValue();

template <typename T>
T*
setTlsPtrSlotValue(T* p);

template <typename T>
rc::Ptr<T>
setTlsPtrSlotValue(const rc::Ptr<T>& ptr);

} // namespace sys