The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Functions
schedule.h File Reference

Scheduler communication. More...

#include <freeradius-devel/io/channel.h>
#include <freeradius-devel/io/network.h>
#include <freeradius-devel/io/worker.h>
#include <freeradius-devel/util/log.h>
+ Include dependency graph for schedule.h:

Go to the source code of this file.

Data Structures

struct  fr_schedule_config_t
 

Typedefs

typedef struct fr_schedule_s fr_schedule_t
 
typedef void(* fr_schedule_thread_detach_t) (void *uctx)
 Explicitly free resources allocated by fr_schedule_thread_instantiate_t. More...
 
typedef int(* fr_schedule_thread_instantiate_t) (TALLOC_CTX *ctx, fr_event_list_t *el, void *uctx)
 Setup a new thread. More...
 

Functions

fr_schedule_tfr_schedule_create (TALLOC_CTX *ctx, fr_event_list_t *el, fr_log_t *log, fr_log_lvl_t lvl, fr_schedule_thread_instantiate_t worker_thread_instantiate, fr_schedule_thread_detach_t worked_thread_detach, fr_schedule_config_t *config))
 Create a scheduler and spawn the child threads. More...
 
int fr_schedule_destroy (fr_schedule_t **sc)
 Destroy a scheduler, and tell its child threads to exit. More...
 
fr_network_tfr_schedule_directory_add (fr_schedule_t *sc, fr_listen_t *li)
 Add a directory NOTE_EXTEND to a scheduler. More...
 
fr_network_tfr_schedule_listen_add (fr_schedule_t *sc, fr_listen_t *li)
 Add a fr_listen_t to a scheduler. More...
 
int fr_schedule_pthread_create (pthread_t *thread, void *(*func)(void *), void *arg)
 Creates a new thread using our standard set of options. More...
 
int fr_schedule_worker_id (void)
 Return the worker id for the current thread. More...
 

Detailed Description

Scheduler communication.

Id
9c91134ac01cdb2464aff87433a43c5d449e122e

Definition in file schedule.h.


Data Structure Documentation

◆ fr_schedule_config_t

struct fr_schedule_config_t

Definition at line 63 of file schedule.h.

+ Collaboration diagram for fr_schedule_config_t:
Data Fields
uint32_t max_networks number of network threads
uint32_t max_workers number of network threads
fr_network_config_t network configuration for each network;
fr_time_delta_t stats_interval print channel statistics
fr_worker_config_t worker configuration for each worker

Typedef Documentation

◆ fr_schedule_t

typedef struct fr_schedule_s fr_schedule_t

Definition at line 1 of file schedule.h.

◆ fr_schedule_thread_detach_t

typedef void(* fr_schedule_thread_detach_t) (void *uctx)

Explicitly free resources allocated by fr_schedule_thread_instantiate_t.

Parameters
[in]uctxUser data passed to callback.

Definition at line 61 of file schedule.h.

◆ fr_schedule_thread_instantiate_t

typedef int(* fr_schedule_thread_instantiate_t) (TALLOC_CTX *ctx, fr_event_list_t *el, void *uctx)

Setup a new thread.

Parameters
[in]ctxto allocate any thread specific memory in.
[in]elEvent list used by the thread.
[in]uctxUser data passed to callback.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 55 of file schedule.h.

Function Documentation

◆ fr_schedule_create()

fr_schedule_t* fr_schedule_create ( TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_log_t logger,
fr_log_lvl_t  lvl,
fr_schedule_thread_instantiate_t  worker_thread_instantiate,
fr_schedule_thread_detach_t  worker_thread_detach,
fr_schedule_config_t config 
)

Create a scheduler and spawn the child threads.

Parameters
[in]ctxtalloc context.
[in]elevent list, only for single-threaded mode.
[in]loggerdestination for all logging messages.
[in]lvllog level.
[in]worker_thread_instantiatecallback for new worker threads.
[in]worker_thread_detachcallback to destroy resources allocated by worker_thread_instantiate.
[in]configconfiguration for the scheduler
Returns
  • NULL on error
  • fr_schedule_t new scheduler

Definition at line 409 of file schedule.c.

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

◆ fr_schedule_destroy()

int fr_schedule_destroy ( fr_schedule_t **  sc_to_free)

Destroy a scheduler, and tell its child threads to exit.

Note
This may be called with no worker or network threads in the case of a instantiation error. This function should deal with that condition gracefully.
Parameters
[in]sc_to_freethe scheduler
Returns
  • <0 on error
  • 0 on success

Definition at line 703 of file schedule.c.

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

◆ fr_schedule_directory_add()

fr_network_t* fr_schedule_directory_add ( fr_schedule_t sc,
fr_listen_t li 
)

Add a directory NOTE_EXTEND to a scheduler.

Parameters
[in]scthe scheduler
[in]lithe ctx and callbacks for the transport.
Returns
  • NULL on error
  • the fr_network_t that the socket was added to.

Definition at line 855 of file schedule.c.

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

◆ fr_schedule_listen_add()

fr_network_t* fr_schedule_listen_add ( fr_schedule_t sc,
fr_listen_t li 
)

Add a fr_listen_t to a scheduler.

Parameters
[in]scthe scheduler
[in]lithe ctx and callbacks for the transport.
Returns
  • NULL on error
  • the fr_network_t that the socket was added to.

Definition at line 823 of file schedule.c.

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

◆ fr_schedule_pthread_create()

int fr_schedule_pthread_create ( pthread_t *  thread,
void *(*)(void *)  func,
void *  arg 
)

Creates a new thread using our standard set of options.

New threads are:

  • Joinable, i.e. you can call pthread_join on them to confirm they've exited
  • Immune to catchable signals.
Parameters
[out]threadhandled 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 371 of file schedule.c.

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

◆ fr_schedule_worker_id()

int fr_schedule_worker_id ( void  )

Return the worker id for the current thread.

Returns
worker ID

Definition at line 157 of file schedule.c.