BlitzMax Extended  0.8.19
Pushing Blitz to the Max.
Data Structures | Typedefs | Functions
blitz_thread.h File Reference

Functionality to utilize multi-threading capabilities. More...

#include "_common.h"
#include <pthread.h>
#include <unistd.h>
#include <signal.h>

Go to the source code of this file.

Data Structures

struct  BBThread
 Represents a single thread of execution. More...

Typedefs

typedef BBObject *(* BBThreadProc )(BBObject *)
 Signature of a function that contains the thread's logic.

Functions

BBThreadbbThreadCreate (BBThreadProc entry, BBObject *data)
 Creates a new thread.
BBThreadbbThreadGetMain ()
 Gets the application's main thread of execution.
BBThreadbbThreadGetCurrent ()
 Gets the current thread in which a function is running.
BBInt bbAtomicAdd (volatile BBInt *target, BBInt incr)
 Atomically adds a number to an integer.

Detailed Description

Functionality to utilize multi-threading capabilities.

Author:
Mark Sibly

Typedef Documentation

typedef BBObject*(* BBThreadProc)(BBObject *)

Signature of a function that contains the thread's logic.

See also:
bbThreadCreate

Function Documentation

BBInt bbAtomicAdd ( volatile BBInt target,
BBInt  incr 
)

Atomically adds a number to an integer.

Parameters:
targetA pointer to the value that should be increased
incrThe number which will be added to the target number
Returns:
The result of the addition as an integer
BBThread* bbThreadCreate ( BBThreadProc  entry,
BBObject data 
)

Creates a new thread.

Parameters:
entryThe callback function executing the thread's business logic data Data passed to the callback functio
Returns:
A new thread that will execute the callback function
BBThread* bbThreadGetCurrent ( )

Gets the current thread in which a function is running.

Can be used with bbThreadGetMain to determine if a code section is currently being executed in the main thread.

Returns:
A pointer to the currently executing thread
BBThread* bbThreadGetMain ( )

Gets the application's main thread of execution.

Returns:
A pointer to the main thread