Iros
 
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1#pragma once
2
7#include "dius/error.h"
8
9#ifndef DIUS_USE_RUNTIME
10#include <mutex>
11#include <pthread.h>
12#endif
13
14namespace di::sync {
15class DumbSpinlock;
16}
17
18namespace di::platform {
19#ifndef DIUS_USE_RUNTIME
20using ThreadId = pthread_t;
21
22using DefaultLock = std::mutex;
23
24inline auto get_current_thread_id() -> ThreadId {
25 return pthread_self();
26}
27#else
28using ThreadId = i32;
29
31
32using DefaultLock = sync::DumbSpinlock;
33#endif
34
35using DefaultAllocator = container::InfallibleAllocator;
36using DefaultFallibleAllocator = container::FallibleAllocator;
37}
Definition dumb_spinlock.h:13
Definition custom.h:30
container::FallibleAllocator DefaultFallibleAllocator
Definition custom.h:40
std::mutex DefaultLock
Definition custom.h:37
container::InfallibleAllocator DefaultAllocator
Definition custom.h:39
auto get_current_thread_id() -> ThreadId
Definition custom.h:33
std::thread::id ThreadId
Definition custom.h:31
Definition atomic.h:12
__INT32_TYPE__ i32
Definition integers.h:16