90#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
91# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
94#ifndef PLIBSYS_HEADER_PUTHREAD_H
95#define PLIBSYS_HEADER_PUTHREAD_H
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS.
#define P_LIB_API
Exports a symbol from a shared library.
void(* PDestroyFunc)(ppointer data)
Object destroy notification function.
char pchar
Type for a char.
unsigned int psize
Type for a platform independent size_t.
void * P_HANDLE
Platform independent system handle.
void * ppointer
Type for a pointer.
signed int pboolean
Type for a bool.
unsigned int puint32
Type for unsigned 32 bit.
P_LIB_API void p_uthread_set_local(PUThreadKey *key, ppointer value)
Sets a TLS value.
P_LIB_API void p_uthread_replace_local(PUThreadKey *key, ppointer value)
Replaces a TLS value.
P_LIB_API P_HANDLE p_uthread_current_id(void)
Gets an ID of the current (caller) thread.
P_LIB_API void p_uthread_exit(pint code)
Exits from the currently running (caller) thread.
P_LIB_API void p_uthread_yield(void)
Tells the scheduler to skip the current (caller) thread in the current planning stage.
P_LIB_API pint p_uthread_ideal_count(void)
Gets the ideal number of threads for the system based on the number of avaialble CPUs and cores (phys...
P_LIB_API pint p_uthread_join(PUThread *thread)
Waits for the selected thread to become finished.
P_LIB_API void p_uthread_local_free(PUThreadKey *key)
Frees a TLS reference key.
P_LIB_API pint p_uthread_sleep(puint32 msec)
Sleeps the current thread (caller) for a specified amount of time.
P_LIB_API void p_uthread_ref(PUThread *thread)
Increments a thread reference counter.
P_LIB_API pboolean p_uthread_set_priority(PUThread *thread, PUThreadPriority prio)
Sets a thread priority.
P_LIB_API PUThread * p_uthread_current(void)
Gets a thread structure of the current (caller) thread.
PUThreadPriority_
Thread priority.
@ P_UTHREAD_PRIORITY_LOW
Scheduled less often than P_UTHREAD_PRIORITY_NORMAL.
@ P_UTHREAD_PRIORITY_TIMECRITICAL
Scheduled as often as possible.
@ P_UTHREAD_PRIORITY_INHERIT
Inherits the caller thread priority.
@ P_UTHREAD_PRIORITY_NORMAL
Operating system's default priority.
@ P_UTHREAD_PRIORITY_LOWEST
Scheduled less often than P_UTHREAD_PRIORITY_LOW.
@ P_UTHREAD_PRIORITY_IDLE
Scheduled only when no other threads are running.
@ P_UTHREAD_PRIORITY_HIGHEST
Scheduled more often than P_UTHREAD_PRIORITY_HIGH.
@ P_UTHREAD_PRIORITY_HIGH
Scheduled more often than P_UTHREAD_PRIORITY_NORMAL.
P_LIB_API PUThread * p_uthread_create_full(PUThreadFunc func, ppointer data, pboolean joinable, PUThreadPriority prio, psize stack_size, const pchar *name)
Creates a new PUThread and starts it.
P_LIB_API PUThreadKey * p_uthread_local_new(PDestroyFunc free_func)
Create a new TLS reference key.
ppointer(* PUThreadFunc)(ppointer arg)
Typedef for a PUThread running method.
struct PUThreadKey_ PUThreadKey
TLS key opaque data type.
P_LIB_API ppointer p_uthread_get_local(PUThreadKey *key)
Gets a TLS value.
struct PUThread_ PUThread
Thread opaque data type.
P_LIB_API void p_uthread_unref(PUThread *thread)
Decrements a thread reference counter.
P_LIB_API PUThread * p_uthread_create(PUThreadFunc func, ppointer data, pboolean joinable, const pchar *name)
Creates a PUThread and starts it.
enum PUThreadPriority_ PUThreadPriority
Thread priority.