26RCSIDH(thread_h,
"$Id: 58e4b0f3796b48c488841a74922653cce1cb4cf2 $")
28#include <freeradius-devel/util/event.h>
29#include <freeradius-devel/util/semaphore.h>
30#include <freeradius-devel/util/talloc.h>
31#include <freeradius-devel/util/dlist.h>
61typedef void *(*fr_thread_entry_t)(
void *);
Head of a doubly linked list.
Entry in a doubly linked list.
Stores all information relating to an event list.
fr_thread_status_t status
running, etc.
char const * name
of this thread
void fr_thread_start(fr_thread_t *thread, fr_sem_t *sem)
Signal the parent that we're done.
int fr_thread_create(pthread_t *thread, fr_thread_entry_t func, void *arg))
Create a joinable thread.
fr_event_list_t * el
our event list
int id
unique ID for this thread
int fr_thread_wait_list(fr_sem_t *sem, fr_dlist_head_t *head)
Wait for multiple threads to signal readiness via a semaphore.
fr_thread_status_t
Track the child thread status.
@ FR_THREAD_RUNNING
running, and in the running queue
@ FR_THREAD_INITIALIZING
initialized, but not running
@ FR_THREAD_EXITED
exited, and in the exited queue
@ FR_THREAD_FREE
child is free
@ FR_THREAD_FAIL
failed, and in the exited queue
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.
fr_dlist_t entry
entry into the parent linked list of threads
int fr_thread_instantiate(TALLOC_CTX *ctx, fr_event_list_t *el)
Instantiate thread-specific data for modules, virtual servers, xlats, unlang, and TLS.
void fr_thread_detach(void)
Detach thread-specific data for modules, virtual servers, xlats.
TALLOC_CTX * ctx
our allocation ctx
pthread_t pthread_id
of this thread
void fr_thread_exit(fr_thread_t *thread, fr_thread_status_t status, fr_sem_t *sem)
Signal the parent that we're done.
void *(* fr_thread_entry_t)(void *)
static fr_event_list_t * el
static size_t char ** out