The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Functions
thread.c File Reference

Common thread instantiation and detach for worker and coordinator threads. More...

#include <freeradius-devel/io/thread.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/virtual_servers.h>
#include <freeradius-devel/server/main_config.h>
#include <freeradius-devel/tls/base.h>
#include <freeradius-devel/unlang/base.h>
#include <freeradius-devel/util/syserror.h>
#include <signal.h>
+ Include dependency graph for thread.c:

Go to the source code of this file.

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.
 

Detailed Description

Common thread instantiation and detach for worker and coordinator threads.

Id
2ef38705fdabec2e013e515ea5048cd3a7a13210

Definition in file thread.c.

Function Documentation

◆ fr_thread_create()

int fr_thread_create ( pthread_t *  thread,
fr_thread_entry_t  func,
void *  arg 
)

Create a joinable thread.

Parameters
[out]threadhandle that was created by pthread_create.
[in]funcentry point for the thread.
[in]argArgument to pass to func.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 46 of file thread.c.

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

◆ fr_thread_detach()

void fr_thread_detach ( void  )

Detach thread-specific data for modules, virtual servers, xlats.

Calls detach in reverse order of instantiation.

Definition at line 190 of file thread.c.

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

◆ fr_thread_exit()

void fr_thread_exit ( fr_thread_t thread,
fr_thread_status_t  status,
fr_sem_t sem 
)

Signal the parent that we're done.

Parameters
[out]threadwhich is exiting
[in]statusto write
[in]semsemaphore to signal.

Definition at line 218 of file thread.c.

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

◆ fr_thread_instantiate()

int fr_thread_instantiate ( TALLOC_CTX *  ctx,
fr_event_list_t el 
)

Instantiate thread-specific data for modules, virtual servers, xlats, unlang, and TLS.

Parameters
[in]ctxto allocate thread-specific data in.
[in]elevent list for this thread.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 165 of file thread.c.

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

◆ fr_thread_setup()

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.

Parameters
[out]outstructure describing the thread
[in]nameHuman-readable name used for the talloc context and error messages.
Returns
  • 0 on success.
  • <0 on failure

Definition at line 112 of file thread.c.

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

◆ fr_thread_start()

void fr_thread_start ( fr_thread_t thread,
fr_sem_t sem 
)

Signal the parent that we're done.

Parameters
[out]threadwhich is starting
[in]semsemaphore to signal.

Definition at line 203 of file thread.c.

+ Here is the caller graph for this function:

◆ fr_thread_wait_list()

int fr_thread_wait_list ( fr_sem_t sem,
fr_dlist_head_t head 
)

Wait for multiple threads to signal readiness via a semaphore.

Parameters
[in]semsemaphore to wait on.
[in]headhead of the list to wait for
Returns
  • 0 for success
  • <0 negative number of threads which failed to start

Definition at line 79 of file thread.c.

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