CAEN Utility  2.0.2
Utilities for CAEN projects
CAENThread.c File Reference

Functions to handle threads, inspired to C11 threads.h. More...

#include <CAENThread.h>
#include <unistd.h>
#include <pthread.h>
#include <sched.h>
#include <errno.h>
#include <time.h>
#include <CAENUtility.h>
#include <CAENMultiplatform.h>
#include <CAENLogger.h>
Include dependency graph for CAENThread.c:

Go to the source code of this file.

Data Structures

struct  tstart_wrapper_t
 

Functions

int32_t c_thread_setaffinity (c_thread_t thr, uint64_t mask)
 
c_thread_t c_thread_current (void)
 
void c_thread_yield (void)
 
int32_t c_thread_detach (c_thread_t thr)
 
void c_thread_exit (int res)
 
bool c_thread_equal (c_thread_t lhs, c_thread_t rhs)
 
static struct timespec _getTimeSpecFromNow (uint32_t ms)
 
int32_t c_semaphore_init (c_semaphore_t *s)
 
int32_t c_semaphore_multi_init (c_semaphore_t *s)
 
int32_t c_semaphore_destroy (c_semaphore_t *s)
 
int32_t c_semaphore_wait (c_semaphore_t *s, int32_t ms)
 
int32_t c_semaphore_post (c_semaphore_t *s)
 
int32_t c_mutex_init (c_mutex_t *m)
 
int32_t c_mutex_lock (c_mutex_t *m)
 
int32_t c_mutex_trylock (c_mutex_t *m)
 
int32_t c_mutex_unlock (c_mutex_t *m)
 
int32_t c_mutex_destroy (c_mutex_t *m)
 
int32_t c_condition_init (c_condition_t *cond)
 
int32_t c_condition_destroy (c_condition_t *cond)
 
int32_t c_condition_lock (c_condition_t *cond)
 
int32_t c_condition_unlock (c_condition_t *cond)
 
int32_t c_condition_wait (c_condition_t *cond, int32_t ms)
 
int32_t c_condition_signal_one (c_condition_t *cond)
 
int32_t c_condition_broadcast (c_condition_t *cond)
 
int32_t c_thread_sleep (const struct timespec *duration, struct timespec *remaining)
 
int32_t c_sleep (uint32_t ms)
 
static void * _tstart_wrapper_function (void *_arg)
 
c_thread_t c_thread_invalid ()
 
int32_t c_thread_create (c_thread_t *thr, c_tstart_t t, void *arg)
 
int32_t c_thread_join (c_thread_t thr, int *res)
 
int32_t c_thread_timedjoin (c_thread_t thr, int *res, int32_t ms)
 
int32_t c_ticket_init (c_ticket_t *ticket)
 
int32_t c_ticket_delete (c_ticket_t *ticket)
 
static uint64_t _getnewticketnumber (c_ticket_t *ticket)
 
int32_t c_ticket_lock (c_ticket_t *ticket)
 
int32_t c_ticket_unlock (c_ticket_t *ticket)
 

Variables

static const c_locallogger_t __locallogger = { ( "CAENThreadLog.txt" ), ( "CAENThread.c" ) }
 

Detailed Description

Functions to handle threads, inspired to C11 threads.h.

Author

Definition in file CAENThread.c.

Function Documentation

◆ _getTimeSpecFromNow()

static struct timespec _getTimeSpecFromNow ( uint32_t  ms)
static

Definition at line 167 of file CAENThread.c.

Here is the caller graph for this function:

◆ _tstart_wrapper_function()

static void* _tstart_wrapper_function ( void *  _arg)
static

Definition at line 595 of file CAENThread.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _getnewticketnumber()

static uint64_t _getnewticketnumber ( c_ticket_t ticket)
static

Definition at line 729 of file CAENThread.c.

Here is the caller graph for this function:

Variable Documentation

◆ __locallogger

const c_locallogger_t __locallogger = { ( "CAENThreadLog.txt" ), ( "CAENThread.c" ) }
static

Definition at line 53 of file CAENThread.c.