expose platform_thread.h to users of milepost
This commit is contained in:
parent
ff5e6e6039
commit
003af621a0
|
@ -28,6 +28,7 @@
|
||||||
#include"platform/platform_clock.h"
|
#include"platform/platform_clock.h"
|
||||||
#include"platform/platform_path.h"
|
#include"platform/platform_path.h"
|
||||||
#include"platform/platform_io.h"
|
#include"platform/platform_io.h"
|
||||||
|
#include"platform/platform_thread.h"
|
||||||
/*
|
/*
|
||||||
#include"platform_rng.h"
|
#include"platform_rng.h"
|
||||||
#include"platform_socket.h"
|
#include"platform_socket.h"
|
||||||
|
|
|
@ -34,17 +34,14 @@ typedef struct mp_thread mp_thread;
|
||||||
|
|
||||||
typedef i32 (*mp_thread_start_function)(void* userPointer);
|
typedef i32 (*mp_thread_start_function)(void* userPointer);
|
||||||
|
|
||||||
mp_thread* mp_thread_create(mp_thread_start_function start, void* userPointer);
|
MP_API mp_thread* mp_thread_create(mp_thread_start_function start, void* userPointer);
|
||||||
mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* userPointer, const char* name);
|
MP_API mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* userPointer, const char* name);
|
||||||
|
MP_API const char* mp_thread_get_name(mp_thread* thread);
|
||||||
const char* mp_thread_get_name(mp_thread* thread);
|
MP_API u64 mp_thread_unique_id(mp_thread* thread);
|
||||||
|
MP_API u64 mp_thread_self_id();
|
||||||
u64 mp_thread_unique_id(mp_thread* thread);
|
MP_API int mp_thread_signal(mp_thread* thread, int sig);
|
||||||
u64 mp_thread_self_id();
|
MP_API int mp_thread_join(mp_thread* thread, i64* exitCode);
|
||||||
|
MP_API int mp_thread_detach(mp_thread* thread);
|
||||||
int mp_thread_signal(mp_thread* thread, int sig);
|
|
||||||
int mp_thread_join(mp_thread* thread, i64* exitCode);
|
|
||||||
int mp_thread_detach(mp_thread* thread);
|
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Platform Mutex API
|
// Platform Mutex API
|
||||||
|
@ -52,10 +49,10 @@ int mp_thread_detach(mp_thread* thread);
|
||||||
|
|
||||||
typedef struct mp_mutex mp_mutex;
|
typedef struct mp_mutex mp_mutex;
|
||||||
|
|
||||||
mp_mutex* mp_mutex_create();
|
MP_API mp_mutex* mp_mutex_create();
|
||||||
int mp_mutex_destroy(mp_mutex* mutex);
|
MP_API int mp_mutex_destroy(mp_mutex* mutex);
|
||||||
int mp_mutex_lock(mp_mutex* mutex);
|
MP_API int mp_mutex_lock(mp_mutex* mutex);
|
||||||
int mp_mutex_unlock(mp_mutex* mutex);
|
MP_API int mp_mutex_unlock(mp_mutex* mutex);
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Lightweight ticket mutex API
|
// Lightweight ticket mutex API
|
||||||
|
@ -67,9 +64,9 @@ typedef struct mp_ticket_spin_mutex
|
||||||
volatile _Atomic(u64) serving;
|
volatile _Atomic(u64) serving;
|
||||||
} mp_ticket_spin_mutex;
|
} mp_ticket_spin_mutex;
|
||||||
|
|
||||||
void mp_ticket_spin_mutex_init(mp_ticket_spin_mutex* mutex);
|
MP_API void mp_ticket_spin_mutex_init(mp_ticket_spin_mutex* mutex);
|
||||||
void mp_ticket_spin_mutex_lock(mp_ticket_spin_mutex* mutex);
|
MP_API void mp_ticket_spin_mutex_lock(mp_ticket_spin_mutex* mutex);
|
||||||
void mp_ticket_spin_mutex_unlock(mp_ticket_spin_mutex* mutex);
|
MP_API void mp_ticket_spin_mutex_unlock(mp_ticket_spin_mutex* mutex);
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Platform condition variable API
|
// Platform condition variable API
|
||||||
|
@ -77,12 +74,12 @@ void mp_ticket_spin_mutex_unlock(mp_ticket_spin_mutex* mutex);
|
||||||
|
|
||||||
typedef struct mp_condition mp_condition;
|
typedef struct mp_condition mp_condition;
|
||||||
|
|
||||||
mp_condition* mp_condition_create();
|
MP_API mp_condition* mp_condition_create();
|
||||||
int mp_condition_destroy(mp_condition* cond);
|
MP_API int mp_condition_destroy(mp_condition* cond);
|
||||||
int mp_condition_wait(mp_condition* cond, mp_mutex* mutex);
|
MP_API int mp_condition_wait(mp_condition* cond, mp_mutex* mutex);
|
||||||
int mp_condition_timedwait(mp_condition* cond, mp_mutex* mutex, f64 seconds);
|
MP_API int mp_condition_timedwait(mp_condition* cond, mp_mutex* mutex, f64 seconds);
|
||||||
int mp_condition_signal(mp_condition* cond);
|
MP_API int mp_condition_signal(mp_condition* cond);
|
||||||
int mp_condition_broadcast(mp_condition* cond);
|
MP_API int mp_condition_broadcast(mp_condition* cond);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
Loading…
Reference in New Issue