DTS Application Library  0.2.3
Application library containing referenced objects and interfaces to common libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
thread.c File Reference

Functions for starting and managing threads. More...

#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <stdint.h>
#include "include/dtsapp.h"

Go to the source code of this file.

Data Structures

struct  thread_pvt
 thread struct used to create threads data needs to be first element More...
 
struct  threadcontainer
 Global threads data. More...
 

Enumerations

enum  threadopt {
  TL_THREAD_NONE = 1 << 0, TL_THREAD_RUN = 1 << 1, TL_THREAD_DONE = 1 << 2, TL_THREAD_JOIN = 1 << 3,
  TL_THREAD_STOP = 1 << 4, TL_THREAD_CAN_CANCEL = 1 << 16, TL_THREAD_JOINABLE = 1 << 17, TL_THREAD_RETURN = 1 << 18
}
 Thread status a thread can be disabled by unsetting TL_THREAD_RUN. More...
 

Functions

int framework_threadok ()
 let threads check there status. More...
 
int startthreads (void)
 Initialise the threadlist and start manager thread. More...
 
void stopthreads (int join)
 Signal manager to stop and cancel all running threads. More...
 
struct thread_pvtframework_mkthread (threadfunc func, threadcleanup cleanup, threadsighandler sig_handler, void *data, int flags)
 create a thread result must be unreferenced More...
 
void jointhreads (void)
 Join the manager thread. More...
 
int thread_signal (int sig)
 Handle signal if its for me. More...
 

Variables

struct threadcontainerthreads = NULL
 Thread control data. More...
 
int thread_can_start = 1
 Automatically start manager thread. More...
 

Detailed Description

Functions for starting and managing threads.

The thread interface consists of a management thread managing a hashed bucket list of threads running optional clean up when done.

Definition in file thread.c.