liblscp 1.0.0

Macros | Typedefs | Enumerations | Functions
thread.h File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <pthread.h>`
`#include "lscp/version.h"`

Go to the source code of this file.

## Macros
#define | lscp_mutex_init(m) pthread_mutex_init(&(m), NULL)
#define | lscp_mutex_destroy(m) pthread_mutex_destroy(&(m))
#define | lscp_mutex_lock(m) pthread_mutex_lock(&(m))
#define | lscp_mutex_unlock(m) pthread_mutex_unlock(&(m))
#define | lscp_cond_init(c) pthread_cond_init(&(c), NULL)
#define | lscp_cond_destroy(c) pthread_cond_destroy(&(c))
#define | lscp_cond_wait(c, m) pthread_cond_wait(&(c), &(m))
#define | lscp_cond_signal(c) pthread_cond_signal(&(c))
#define | lscp_thread_exit() pthread_exit(NULL)

## Typedefs
typedef enum _lscp_status_t | lscp_status_t
typedef pthread_mutex_t | lscp_mutex_t
typedef pthread_cond_t | lscp_cond_t
typedef void(* | lscp_thread_proc_t) (void *pvData)
typedef struct _lscp_thread_t | lscp_thread_t

## Enumerations
enum | _lscp_status_t { LSCP_OK = 0 , LSCP_FAILED = -1 , LSCP_ERROR = -2 , LSCP_WARNING = -3 , LSCP_TIMEOUT = -4 , LSCP_QUIT = -5 }

## Functions
lscp_thread_t * | lscp_thread_create (lscp_thread_proc_t pfnProc, void *pvData, int iDetach)
lscp_status_t | lscp_thread_join (lscp_thread_t *pThread)
lscp_status_t | lscp_thread_cancel (lscp_thread_t *pThread)
lscp_status_t | lscp_thread_destroy (lscp_thread_t *pThread)

## Macro Definition Documentation

## ◆ lscp_cond_destroy

#define lscp_cond_destroy | ( |  | c | ) | pthread_cond_destroy(&(c))

## ◆ lscp_cond_init

#define lscp_cond_init | ( |  | c | ) | pthread_cond_init(&(c), NULL)

## ◆ lscp_cond_signal

#define lscp_cond_signal | ( |  | c | ) | pthread_cond_signal(&(c))

## ◆ lscp_cond_wait

#define lscp_cond_wait | ( |  | c,
|  |  | m
| ) |  | pthread_cond_wait(&(c), &(m))

## ◆ lscp_mutex_destroy

#define lscp_mutex_destroy | ( |  | m | ) | pthread_mutex_destroy(&(m))

## ◆ lscp_mutex_init

#define lscp_mutex_init | ( |  | m | ) | pthread_mutex_init(&(m), NULL)

## ◆ lscp_mutex_lock

#define lscp_mutex_lock | ( |  | m | ) | pthread_mutex_lock(&(m))

## ◆ lscp_mutex_unlock

#define lscp_mutex_unlock | ( |  | m | ) | pthread_mutex_unlock(&(m))

## ◆ lscp_thread_exit

#define lscp_thread_exit | ( |  | ) | pthread_exit(NULL)

## Typedef Documentation

## ◆ lscp_cond_t

typedef pthread_cond_t lscp_cond_t

## ◆ lscp_mutex_t

typedef pthread_mutex_t lscp_mutex_t

## ◆ lscp_status_t

typedef enum _lscp_status_t lscp_status_t

## ◆ lscp_thread_proc_t

typedef void(* lscp_thread_proc_t) (void *pvData)

## ◆ lscp_thread_t

typedef struct _lscp_thread_t lscp_thread_t

## Enumeration Type Documentation

## ◆ _lscp_status_t

enum _lscp_status_t

Enumerator
LSCP_OK |
LSCP_FAILED |
LSCP_ERROR |
LSCP_WARNING |
LSCP_TIMEOUT |
LSCP_QUIT |

## Function Documentation

## ◆ lscp_thread_cancel()

lscp_status_t lscp_thread_cancel | ( | lscp_thread_t * | pThread | ) |

References LSCP_FAILED, LSCP_OK, and _lscp_thread_t::pthread.

Referenced by lscp_thread_destroy().

## ◆ lscp_thread_create()

lscp_thread_t * lscp_thread_create | ( | lscp_thread_proc_t | pfnProc,
|  | void * | pvData,
|  | int | iDetach
| ) |  |

References _lscp_thread_t::iDetach, _lscp_thread_t::pfnProc, and _lscp_thread_t::pvData.

Referenced by lscp_socket_agent_start().

## ◆ lscp_thread_destroy()

lscp_status_t lscp_thread_destroy | ( | lscp_thread_t * | pThread | ) |

References LSCP_OK, lscp_thread_cancel(), and lscp_thread_join().

Referenced by lscp_socket_agent_free(), and lscp_socket_agent_start().

## ◆ lscp_thread_join()

lscp_status_t lscp_thread_join | ( | lscp_thread_t * | pThread | ) |

References LSCP_FAILED, LSCP_OK, and _lscp_thread_t::pthread.

Referenced by lscp_socket_agent_join(), and lscp_thread_destroy().