libsheepy
Data Structures | Macros | Typedefs | Functions | Variables
tpool.c File Reference
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
#include "libsheepyObject.h"
#include "tpool.h"
Include dependency graph for tpool.c:

Go to the source code of this file.

Data Structures

struct  bsem
 
struct  job
 
struct  jobqueue
 
struct  thread
 
struct  tpool_
 

Macros

#define _POSIX_C_SOURCE   200809L
 
#define tpool_DEBUG   0
 
#define err(str)   logE(str)
 

Typedefs

typedef struct bsem bsem
 
typedef struct job job
 
typedef struct jobqueue jobqueue
 
typedef struct thread thread
 
typedef struct tpool_ tpool_
 

Functions

void tpoolLock (int position)
 
void tpoolUlock (int position)
 
threadpool tpool_init (int num_threads)
 
int tpool_add_work (threadpool tpool_p, void(*function_p)(void *), void *arg_p)
 
void tpool_wait (threadpool tpool_p)
 
void tpool_destroy (threadpool tpool_p)
 
void tpool_pause (threadpool tpool_p)
 
void tpool_resume (threadpool tpool_p)
 
int tpool_num_threads_working (threadpool tpool_p)
 

Variables

pthread_mutex_t tpoolLocks [tpoolLockCount]
 
threadpool tpool
 

Macro Definition Documentation

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   200809L

Definition at line 11 of file tpool.c.

◆ tpool_DEBUG

#define tpool_DEBUG   0

Definition at line 31 of file tpool.c.

◆ err

#define err (   str)    logE(str)

Definition at line 35 of file tpool.c.

Typedef Documentation

◆ bsem

typedef struct bsem bsem

◆ job

typedef struct job job

◆ jobqueue

typedef struct jobqueue jobqueue

◆ thread

typedef struct thread thread

◆ tpool_

typedef struct tpool_ tpool_

Function Documentation

◆ tpoolLock()

void tpoolLock ( int  position)

Definition at line 127 of file tpool.c.

◆ tpoolUlock()

void tpoolUlock ( int  position)

Definition at line 132 of file tpool.c.

◆ tpool_init()

threadpool tpool_init ( int  num_threads)

Definition at line 137 of file tpool.c.

Here is the caller graph for this function:

◆ tpool_add_work()

int tpool_add_work ( threadpool  tpool_p,
void(*)(void *)  function_p,
void *  arg_p 
)

Definition at line 192 of file tpool.c.

◆ tpool_wait()

void tpool_wait ( threadpool  tpool_p)

Definition at line 221 of file tpool.c.

◆ tpool_destroy()

void tpool_destroy ( threadpool  tpool_p)

Definition at line 232 of file tpool.c.

◆ tpool_pause()

void tpool_pause ( threadpool  tpool_p)

Definition at line 282 of file tpool.c.

◆ tpool_resume()

void tpool_resume ( threadpool  tpool_p)

Definition at line 292 of file tpool.c.

◆ tpool_num_threads_working()

int tpool_num_threads_working ( threadpool  tpool_p)

Definition at line 304 of file tpool.c.

Variable Documentation

◆ tpoolLocks

pthread_mutex_t tpoolLocks[tpoolLockCount]

Definition at line 45 of file tpool.c.

◆ tpool

threadpool tpool

Definition at line 47 of file tpool.c.