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 P_LIB_API PUThreadKey * p_uthread_local_new(PDestroyFunc free_func)
Create a new TLS reference key.
Scheduled less often than P_UTHREAD_PRIORITY_NORMAL.
Definition: puthread.h:116
Scheduled more often than P_UTHREAD_PRIORITY_NORMAL.
Definition: puthread.h:118
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS...
Definition: pmacros.h:299
P_BEGIN_DECLS typedef ppointer(* PUThreadFunc)(ppointer arg)
Typedef for a PUThread running method.
Definition: puthread.h:103
struct PUThreadKey_ PUThreadKey
TLS key opaque data type.
Definition: puthread.h:109
void(* PDestroyFunc)(ppointer data)
Object destroy notification function.
Definition: ptypes.h:1097
P_LIB_API void p_uthread_yield(void)
Tells the scheduler to skip the current (caller) thread in the current planning stage.
unsigned int puint32
Type for unsigned 32 bit.
Definition: ptypes.h:83
Operating system's default priority.
Definition: puthread.h:117
P_LIB_API void p_uthread_set_local(PUThreadKey *key, ppointer value)
Sets a TLS value.
P_LIB_API void p_uthread_unref(PUThread *thread)
Decrements a thread reference counter.
int pint
Type for an int.
Definition: ptypes.h:120
Scheduled more often than P_UTHREAD_PRIORITY_HIGH.
Definition: puthread.h:119
char pchar
Type for a char.
Definition: ptypes.h:116
P_LIB_API void p_uthread_ref(PUThread *thread)
Increments a thread reference counter.
P_LIB_API ppointer p_uthread_get_local(PUThreadKey *key)
Gets a TLS value.
unsigned int psize
Type for a platform independent size_t.
Definition: ptypes.h:224
P_LIB_API P_HANDLE p_uthread_current_id(void)
Gets an ID of the current (caller) thread.
void * ppointer
Type for a pointer.
Definition: ptypes.h:109
P_LIB_API PUThread * p_uthread_current(void)
Gets a thread structure of the current (caller) thread.
enum PUThreadPriority_ PUThreadPriority
Thread priority.
signed int pboolean
Type for a bool.
Definition: ptypes.h:114
void * P_HANDLE
Platform independent system handle.
Definition: ptypes.h:1070
Scheduled less often than P_UTHREAD_PRIORITY_LOW.
Definition: puthread.h:115
Inherits the caller thread priority.
Definition: puthread.h:113
P_LIB_API void p_uthread_replace_local(PUThreadKey *key, ppointer value)
Replaces a TLS value.
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_exit(pint code)
Exits from the currently running (caller) thread.
P_LIB_API void p_uthread_local_free(PUThreadKey *key)
Frees a TLS reference key.
#define P_LIB_API
Exports a symbol from a shared library.
Definition: pmacros.h:138
Scheduled only when no other threads are running.
Definition: puthread.h:114
Scheduled as often as possible.
Definition: puthread.h:120
P_LIB_API PUThread * p_uthread_create(PUThreadFunc func, ppointer data, pboolean joinable, const pchar *name)
Creates a PUThread and starts it.
P_LIB_API pint p_uthread_join(PUThread *thread)
Waits for the selected thread to become finished.
struct PUThread_ PUThread
Thread opaque data type.
Definition: puthread.h:106
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.
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
Definition: pmacros.h:298
P_LIB_API pboolean p_uthread_set_priority(PUThread *thread, PUThreadPriority prio)
Sets a thread priority.
PUThreadPriority_
Thread priority.
Definition: puthread.h:112
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...