thread.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <stdint.h>`
`#include <limits.h>`
`#include <sys/queue.h>`
`#include <sys/ioctl.h>`
`#include <unistd.h>`
`#include <pthread.h>`
`#include <event2/event.h>`
`#include <event2/thread.h>`
`#include "internal.h"`
`#include "evhtp/thread.h"`
Include dependency graph for thread.c:

Go to the source code of this file.

## Data Structures

struct | evthr_cmd_t
struct | evthr_pool
struct | evthr

## Macros

#define | _GNU_SOURCE
#define | _evthr_read(thr, cmd, sock) (recv(sock, cmd, sizeof(evthr_cmd_t), 0) == sizeof(evthr_cmd_t)) ? 1 : 0

## Typedefs

typedef struct evthr_pool_slist | evthr_pool_slist_t

## Functions

struct evthr_cmd | __attribute__ ((packed))
| TAILQ_HEAD (evthr_pool_slist, evthr)
static void | _evthr_read_cmd (evutil_socket_t sock, short which, void *args)
static void * | _evthr_loop (void *args)
evthr_res | evthr_defer (evthr_t *thread, evthr_cb cb, void *arg)
evthr_res | evthr_stop (evthr_t *thread)
evbase_t * | evthr_get_base (evthr_t *thr)
void | evthr_set_aux (evthr_t *thr, void *aux)
void * | evthr_get_aux (evthr_t *thr)
int | evthr_set_initcb (evthr_t *thr, evthr_init_cb cb)
int | evthr_set_exitcb (evthr_t *thr, evthr_exit_cb cb)
static evthr_t * | _evthr_new (evthr_init_cb init_cb, evthr_exit_cb exit_cb, void *args)
evthr_t * | evthr_new (evthr_init_cb init_cb, void *args)
evthr_t * | evthr_wexit_new (evthr_init_cb init_cb, evthr_exit_cb exit_cb, void *args)
int | evthr_start (evthr_t *thread)
void | evthr_free (evthr_t *thread)
void | evthr_pool_free (evthr_pool_t *pool)
evthr_res | evthr_pool_stop (evthr_pool_t *pool)
static int | get_backlog_ (evthr_t *thread)
evthr_res | evthr_pool_defer (evthr_pool_t *pool, evthr_cb cb, void *arg)
static evthr_pool_t * | _evthr_pool_new (int nthreads, evthr_init_cb init_cb, evthr_exit_cb exit_cb, void *shared)
evthr_pool_t * | evthr_pool_new (int nthreads, evthr_init_cb init_cb, void *shared)
evthr_pool_t * | evthr_pool_wexit_new (int nthreads, evthr_init_cb init_cb, evthr_exit_cb exit_cb, void *shared)
int | evthr_pool_start (evthr_pool_t *pool)

## Variables

uint8_t | stop
void * | args
evthr_cb | cb
struct evthr_pool | __attribute__

## Macro Definition Documentation

## _evthr_read

#define _evthr_read | ( |  | thr,
|  |  | cmd,
|  |  | sock
| ) |  | (recv(sock, cmd, sizeof(evthr_cmd_t), 0) == sizeof(evthr_cmd_t)) ? 1 : 0

Definition at line 60 of file thread.c.

## _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 1 of file thread.c.

## Typedef Documentation

## evthr_pool_slist_t

typedef struct evthr_pool_slist evthr_pool_slist_t

Definition at line 21 of file thread.c.

## Function Documentation

## __attribute__()

struct evthr_cmd __attribute__ | ( | (packed) |  | ) |

## _evthr_loop()

static void * _evthr_loop | ( | void * | args | ) |

static

Definition at line 92 of file thread.c.

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

## _evthr_new()

static evthr_t * _evthr_new | ( | evthr_init_cb | init_cb,
|  | evthr_exit_cb | exit_cb,
|  | void * | args
| ) |  |

static

Definition at line 220 of file thread.c.

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

## _evthr_pool_new()

static evthr_pool_t * _evthr_pool_new | ( | int | nthreads,
|  | evthr_init_cb | init_cb,
|  | evthr_exit_cb | exit_cb,
|  | void * | shared
| ) |  |

static

Definition at line 408 of file thread.c.

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

## _evthr_read_cmd()

static void _evthr_read_cmd | ( | evutil_socket_t | sock,
|  | short | which,
|  | void * | args
| ) |  |

static

Definition at line 64 of file thread.c.

Here is the caller graph for this function:

## evthr_defer()

evthr_res evthr_defer | ( | evthr_t * | thread,
|  | evthr_cb | cb,
|  | void * | arg
| ) |  |

Definition at line 143 of file thread.c.

Here is the caller graph for this function:

## evthr_free()

void evthr_free | ( | evthr_t * | thread | ) |

Definition at line 279 of file thread.c.

Here is the caller graph for this function:

## evthr_get_aux()

void * evthr_get_aux | ( | evthr_t * | thr | ) |

Definition at line 190 of file thread.c.

## evthr_get_base()

evbase_t * evthr_get_base | ( | evthr_t * | thr | ) |

Definition at line 176 of file thread.c.

Here is the caller graph for this function:

## evthr_new()

evthr_t * evthr_new | ( | evthr_init_cb | init_cb,
|  | void * | args
| ) |  |

Definition at line 253 of file thread.c.

Here is the call graph for this function:

## evthr_pool_defer()

evthr_res evthr_pool_defer | ( | evthr_pool_t * | pool,
|  | evthr_cb | cb,
|  | void * | arg
| ) |  |

Definition at line 362 of file thread.c.

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

## evthr_pool_free()

void evthr_pool_free | ( | evthr_pool_t * | pool | ) |

Definition at line 316 of file thread.c.

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

## evthr_pool_new()

evthr_pool_t * evthr_pool_new | ( | int | nthreads,
|  | evthr_init_cb | init_cb,
|  | void * | shared
| ) |  |

Definition at line 462 of file thread.c.

Here is the call graph for this function:

## evthr_pool_start()

int evthr_pool_start | ( | evthr_pool_t * | pool | ) |

Definition at line 476 of file thread.c.

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

## evthr_pool_stop()

evthr_res evthr_pool_stop | ( | evthr_pool_t * | pool | ) |

Definition at line 335 of file thread.c.

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

## evthr_pool_wexit_new()

evthr_pool_t * evthr_pool_wexit_new | ( | int | nthreads,
|  | evthr_init_cb | init_cb,
|  | evthr_exit_cb | exit_cb,
|  | void * | shared
| ) |  |

Definition at line 468 of file thread.c.

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

## evthr_set_aux()

void evthr_set_aux | ( | evthr_t * | thr,
|  | void * | aux
| ) |  |

Definition at line 182 of file thread.c.

## evthr_set_exitcb()

int evthr_set_exitcb | ( | evthr_t * | thr,
|  | evthr_exit_cb | cb
| ) |  |

Definition at line 208 of file thread.c.

## evthr_set_initcb()

int evthr_set_initcb | ( | evthr_t * | thr,
|  | evthr_init_cb | cb
| ) |  |

Definition at line 196 of file thread.c.

## evthr_start()

int evthr_start | ( | evthr_t * | thread | ) |

Definition at line 265 of file thread.c.

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

## evthr_stop()

evthr_res evthr_stop | ( | evthr_t * | thread | ) |

Definition at line 159 of file thread.c.

Here is the caller graph for this function:

## evthr_wexit_new()

evthr_t * evthr_wexit_new | ( | evthr_init_cb | init_cb,
|  | evthr_exit_cb | exit_cb,
|  | void * | args
| ) |  |

Definition at line 259 of file thread.c.

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

## get_backlog_()

static int get_backlog_ | ( | evthr_t * | thread | ) |

inline static

Definition at line 352 of file thread.c.

Here is the caller graph for this function:

## TAILQ_HEAD()

TAILQ_HEAD | ( | evthr_pool_slist | ,
|  | evthr |
| ) |  |

## Variable Documentation

## __attribute__

struct evthr_pool __attribute__

## args

void* args

Definition at line 1 of file thread.c.

## cb

evthr_cb cb

Definition at line 2 of file thread.c.

## stop

uint8_t stop

Definition at line 0 of file thread.c.