tor  0.4.2.0-alpha-dev
Data Fields
threadpool_s Struct Reference

Data Fields

struct workerthread_s ** threads
 
tor_cond_t condition
 
work_tailq_t work [WORKQUEUE_N_PRIORITIES]
 
unsigned generation
 
workqueue_reply_t(* update_fn )(void *, void *)
 
void(* free_update_arg_fn )(void *)
 
void ** update_args
 
struct event * reply_event
 
void(* reply_cb )(threadpool_t *)
 
int n_threads
 
tor_mutex_t lock
 
replyqueue_treply_queue
 
void *(* new_thread_state_fn )(void *)
 
void(* free_thread_state_fn )(void *)
 
void * new_thread_state_arg
 

Detailed Description

Definition at line 50 of file workqueue.c.

Field Documentation

◆ condition

tor_cond_t threadpool_s::condition

Condition variable that we wait on when we have no work, and which gets signaled when our queue becomes nonempty.

Definition at line 57 of file workqueue.c.

◆ free_update_arg_fn

void(* threadpool_s::free_update_arg_fn) (void *)

Function to free update arguments if they can't be run.

Definition at line 69 of file workqueue.c.

Referenced by threadpool_queue_update().

◆ generation

unsigned threadpool_s::generation

The current 'update generation' of the threadpool. Any thread that is at an earlier generation needs to run the update function.

Definition at line 64 of file workqueue.c.

Referenced by worker_thread_main().

◆ lock

tor_mutex_t threadpool_s::lock

Mutex to protect all the above fields.

Definition at line 79 of file workqueue.c.

Referenced by threadpool_queue_update(), and worker_thread_main().

◆ n_threads

int threadpool_s::n_threads

Number of elements in threads.

Definition at line 77 of file workqueue.c.

Referenced by threadpool_queue_update().

◆ new_thread_state_fn

void*(* threadpool_s::new_thread_state_fn) (void *)

Functions used to allocate and free thread state.

Definition at line 85 of file workqueue.c.

◆ reply_event

struct event* threadpool_s::reply_event

Event to notice when another thread has sent a reply.

Definition at line 73 of file workqueue.c.

Referenced by threadpool_register_reply_event().

◆ reply_queue

replyqueue_t* threadpool_s::reply_queue

A reply queue to use when constructing new threads.

Definition at line 82 of file workqueue.c.

Referenced by reply_event_cb(), and threadpool_get_replyqueue().

◆ threads

struct workerthread_s** threadpool_s::threads

An array of pointers to workerthread_t: one for each running worker thread.

Definition at line 53 of file workqueue.c.

◆ update_args

void** threadpool_s::update_args

Array of n_threads update arguments.

Definition at line 71 of file workqueue.c.

Referenced by threadpool_queue_update(), and worker_thread_main().

◆ update_fn

workqueue_reply_t(* threadpool_s::update_fn) (void *, void *)

Function that should be run for updates on each thread.

Definition at line 67 of file workqueue.c.

Referenced by worker_thread_main().

◆ work

work_tailq_t threadpool_s::work[WORKQUEUE_N_PRIORITIES]

Queues of pending work that we have to do. The queue with priority p is work[p].

Definition at line 60 of file workqueue.c.

Referenced by queue_reply(), and worker_thread_main().


The documentation for this struct was generated from the following file: