Libevhtp  1.2.13
thread.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
#include <sys/queue.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)
 
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 59 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 20 of file thread.c.

Function Documentation

◆ __attribute__()

struct evthr_cmd __attribute__ ( (packed)  )

◆ _evthr_loop()

static void* _evthr_loop ( void *  args)
static

Definition at line 90 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 207 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 360 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 63 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 137 of file thread.c.

Here is the caller graph for this function:

◆ evthr_free()

void evthr_free ( evthr_t *  thread)

Definition at line 262 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 180 of file thread.c.

◆ evthr_get_base()

evbase_t* evthr_get_base ( evthr_t *  thr)

Definition at line 168 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 239 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 325 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 291 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 413 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 425 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 309 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 418 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 173 of file thread.c.

◆ evthr_set_exitcb()

int evthr_set_exitcb ( evthr_t *  thr,
evthr_exit_cb  cb 
)

Definition at line 196 of file thread.c.

Here is the caller graph for this function:

◆ evthr_set_initcb()

int evthr_set_initcb ( evthr_t *  thr,
evthr_init_cb  cb 
)

Definition at line 185 of file thread.c.

Here is the caller graph for this function:

◆ evthr_start()

int evthr_start ( evthr_t *  thread)

Definition at line 249 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 152 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 244 of file thread.c.

Here is the call graph for this function:
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 119 of file thread.c.

◆ cb

evthr_cb cb

Definition at line 120 of file thread.c.

◆ stop

uint8_t stop

Definition at line 118 of file thread.c.