![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Common thread instantiation and detach for worker and coordinator threads. More...
#include <freeradius-devel/util/event.h>#include <freeradius-devel/util/semaphore.h>#include <freeradius-devel/util/talloc.h>#include <freeradius-devel/util/dlist.h>#include <pthread.h>
Include dependency graph for thread.h:Go to the source code of this file.
Data Structures | |
| struct | fr_thread_t |
Typedefs | |
| typedef void *(* | fr_thread_entry_t) (void *) |
| typedef enum fr_thread_status_t | fr_thread_status_t |
| Track the child thread status. | |
Enumerations | |
| enum | fr_thread_status_t { FR_THREAD_FREE = 0 , FR_THREAD_INITIALIZING , FR_THREAD_RUNNING , FR_THREAD_EXITED , FR_THREAD_FAIL } |
| Track the child thread status. More... | |
Functions | |
| int | fr_thread_create (pthread_t *thread, fr_thread_entry_t func, void *arg)) |
| Create a joinable thread. | |
| void | fr_thread_detach (void) |
| Detach thread-specific data for modules, virtual servers, xlats. | |
| void | fr_thread_exit (fr_thread_t *thread, fr_thread_status_t status, fr_sem_t *sem) |
| Signal the parent that we're done. | |
| int | fr_thread_instantiate (TALLOC_CTX *ctx, fr_event_list_t *el) |
| Instantiate thread-specific data for modules, virtual servers, xlats, unlang, and TLS. | |
| int | fr_thread_setup (fr_thread_t *out, char const *name) |
| Common setup for child threads: block signals, allocate a talloc context, and create an event list. | |
| void | fr_thread_start (fr_thread_t *thread, fr_sem_t *sem) |
| Signal the parent that we're done. | |
| int | fr_thread_wait_list (fr_sem_t *sem, fr_dlist_head_t *head) |
| Wait for multiple threads to signal readiness via a semaphore. | |
Common thread instantiation and detach for worker and coordinator threads.
Definition in file thread.h.
| struct fr_thread_t |
Collaboration diagram for fr_thread_t:| Data Fields | ||
|---|---|---|
| TALLOC_CTX * | ctx | our allocation ctx |
| fr_event_list_t * | el | our event list |
| fr_dlist_t | entry | entry into the parent linked list of threads |
| int | id | unique ID for this thread |
| char const * | name | of this thread |
| pthread_t | pthread_id | of this thread |
| fr_thread_status_t | status | running, etc. |
| typedef enum fr_thread_status_t fr_thread_status_t |
Track the child thread status.
| enum fr_thread_status_t |
| int fr_thread_create | ( | pthread_t * | thread, |
| fr_thread_entry_t | func, | ||
| void * | arg | ||
| ) |
Create a joinable thread.
| [out] | thread | handle that was created by pthread_create. |
| [in] | func | entry point for the thread. |
| [in] | arg | Argument to pass to func. |
Definition at line 46 of file thread.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void fr_thread_detach | ( | void | ) |
| void fr_thread_exit | ( | fr_thread_t * | thread, |
| fr_thread_status_t | status, | ||
| fr_sem_t * | sem | ||
| ) |
| int fr_thread_instantiate | ( | TALLOC_CTX * | ctx, |
| fr_event_list_t * | el | ||
| ) |
Instantiate thread-specific data for modules, virtual servers, xlats, unlang, and TLS.
| [in] | ctx | to allocate thread-specific data in. |
| [in] | el | event list for this thread. |
Definition at line 165 of file thread.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int fr_thread_setup | ( | fr_thread_t * | out, |
| char const * | name | ||
| ) |
Common setup for child threads: block signals, allocate a talloc context, and create an event list.
| [out] | out | structure describing the thread |
| [in] | name | Human-readable name used for the talloc context and error messages. |
Definition at line 112 of file thread.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void fr_thread_start | ( | fr_thread_t * | thread, |
| fr_sem_t * | sem | ||
| ) |
| int fr_thread_wait_list | ( | fr_sem_t * | sem, |
| fr_dlist_head_t * | head | ||
| ) |
Wait for multiple threads to signal readiness via a semaphore.
| [in] | sem | semaphore to wait on. |
| [in] | head | head of the list to wait for |
Definition at line 79 of file thread.c.
Here is the call graph for this function:
Here is the caller graph for this function:
1.9.8