BFLibC 0.1
C Library
|
Go to the source code of this file.
Functions | |
int | BFThreadGetStartedCount () |
void | BFThreadResetStartedCount () |
int | BFThreadGetStoppedCount () |
void | BFThreadResetStoppedCount () |
int | BFThreadSync (void(*callback)(void *), void *args) |
__attribute__ ((deprecated("detach state is now the default behavior. this function is no longer supported"))) int BFThreadAsyncDetach(void(*callback)(void *) | |
BFThreadAsyncID | BFThreadAsync (void(*callback)(void *), void *args) |
bool | BFThreadAsyncIDIsValid (BFThreadAsyncID) |
const BFThreadAsyncID | BFThreadAsyncGetID () |
void | BFThreadAsyncDestroy (BFThreadAsyncID in) |
int | BFThreadAsyncError (BFThreadAsyncID) |
bool | BFThreadAsyncIsRunning (BFThreadAsyncID) |
int | BFThreadAsyncCancel (BFThreadAsyncID) |
bool | BFThreadAsyncIsCanceled (BFThreadAsyncID) |
int | BFThreadAsyncWait (BFThreadAsyncID) |
Variables | |
void * | args |
__attribute__ | ( | (deprecated("detach state is now the default behavior. this function is no longer supported")) | ) |
Launches an async thread and detaches thread
If you want to manage and query an async thread, please consider using BFThreadAsync
NOTICE: this funciton will do nothing
BFThreadAsyncID BFThreadAsync | ( | void(* | callback )(void *), |
void * | args ) |
Launches and detaches callback
on a separate thread
will return while thread is running
us async id to query the async thread
To destroy use BFThreadAsyncIDDestroy
int BFThreadAsyncCancel | ( | BFThreadAsyncID | in | ) |
Sets a flag that is readable
If called, BFThreadAsyncIsCanceled
will always return true
The result of the function is not reversible
void BFThreadAsyncDestroy | ( | BFThreadAsyncID | in | ) |
Releases BFThreadAsyncID
int BFThreadAsyncError | ( | BFThreadAsyncID | id | ) |
returns the error code, if any, for BFThreadAsync
const BFThreadAsyncID BFThreadAsyncGetID | ( | ) |
returns current thread id
caller is not responsible for the memory
returns 0 if there was an error
bool BFThreadAsyncIDIsValid | ( | BFThreadAsyncID | id | ) |
true if we can safely use id
bool BFThreadAsyncIsCanceled | ( | BFThreadAsyncID | in | ) |
If thread has been canceled
caller can safely call this on running thread
bool BFThreadAsyncIsRunning | ( | BFThreadAsyncID | in | ) |
true if callback from BFThreadAsync is still running
thread safe. you can use this function to poll the async thread if it's still running
int BFThreadAsyncWait | ( | BFThreadAsyncID | in | ) |
Waits for thread to finished if BFThreadAsyncIsRunning
is true
this will block function until thread is finished
be careful when you call this. be sure that you know the thread WILL end soon or else this will hang
int BFThreadGetStartedCount | ( | ) |
author: brando date: 10/20/23 returns the count of how many sync/async threads have been launched in current process
int BFThreadGetStoppedCount | ( | ) |
returns the count of how many sync/async threads have been finished in current process
void BFThreadResetStartedCount | ( | ) |
resets the thread launch count
void BFThreadResetStoppedCount | ( | ) |
resets the thread stop count
int BFThreadSync | ( | void(* | callback )(void *), |
void * | args ) |
Launches thread and returns when thread terminates
void* args |