ObjFW
Loading...
Searching...
No Matches
Functions
OFPlainThread.h File Reference
#include "objfw-defs.h"
#include "platform.h"
import "OFObject.h"

Go to the source code of this file.

Functions

static OF_INLINE OFPlainThread OFCurrentPlainThread (void)
 Returns the current plain thread.
 
static OF_INLINE bool OFPlainThreadIsCurrent (OFPlainThread thread)
 Returns whether the specified plain thread is the current thread.
 
int OFPlainThreadAttributesInit (OFPlainThreadAttributes *attr)
 Initializes the specified thread attributes.
 
int OFPlainThreadNew (OFPlainThread *thread, const char *name, void(*function)(id), id object, const OFPlainThreadAttributes *attr)
 Creates a new plain thread.
 
void OFSetThreadName (const char *name)
 Sets the name of the current thread.
 
int OFPlainThreadJoin (OFPlainThread thread)
 Joins the specified thread.
 
int OFPlainThreadDetach (OFPlainThread thread)
 Detaches the specified thread.
 

Function Documentation

◆ OFCurrentPlainThread()

static OF_INLINE OFPlainThread OFCurrentPlainThread ( void )
static

Returns the current plain thread.

Returns
The current plain thread

◆ OFPlainThreadAttributesInit()

int OFPlainThreadAttributesInit ( OFPlainThreadAttributes * attr)
extern

Initializes the specified thread attributes.

Parameters
attrA pointer to the thread attributes to initialize
Returns
0 on success, or an error number from <errno.h> on error

◆ OFPlainThreadDetach()

int OFPlainThreadDetach ( OFPlainThread thread)
extern

Detaches the specified thread.

Parameters
threadThe thread to detach
Returns
0 on success, or an error number from <errno.h> on error

◆ OFPlainThreadIsCurrent()

static OF_INLINE bool OFPlainThreadIsCurrent ( OFPlainThread thread)
static

Returns whether the specified plain thread is the current thread.

Parameters
threadThe thread to check
Returns
Whether the specified plain thread is the current thread

◆ OFPlainThreadJoin()

int OFPlainThreadJoin ( OFPlainThread thread)
extern

Joins the specified thread.

Parameters
threadThe thread to join
Returns
0 on success, or an error number from <errno.h> on error

◆ OFPlainThreadNew()

int OFPlainThreadNew ( OFPlainThread * thread,
const char * name,
void(*)(id) function,
id object,
const OFPlainThreadAttributes * attr )
extern

Creates a new plain thread.

A plain thread is similar to OFThread, but does not use exceptions and is just a lightweight wrapper around the system's thread implementation.

Parameters
threadA pointer to the thread to create
nameA name for the thread
functionThe function the thread should execute
objectThe object to pass to the thread as an argument
attrThread attributes
Returns
0 on success, or an error number from <errno.h> on error

◆ OFSetThreadName()

void OFSetThreadName ( const char * name)
extern

Sets the name of the current thread.

Parameters
nameThe name for the current thread