Functions and data structures for worker threads.
More...
#include <freeradius-devel/io/base.h>
#include <freeradius-devel/server/command.h>
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/heap.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/slab.h>
#include <freeradius-devel/util/talloc.h>
#include <pthread.h>
#include <freeradius-devel/server/module.h>
Go to the source code of this file.
|
| void | fr_worker (fr_worker_t *worker) |
| | The main loop and entry point of the stand-alone worker thread.
|
| |
| fr_worker_t * | fr_worker_alloc (TALLOC_CTX *ctx, fr_event_list_t *el, char const *name, fr_log_t const *logger, fr_log_lvl_t lvl, fr_worker_config_t *config)) |
| | Create a worker.
|
| |
| fr_channel_t * | fr_worker_channel_create (fr_worker_t *worker, TALLOC_CTX *ctx, fr_control_t *master, fr_message_set_t *reply_ms) |
| | Create a channel to the worker.
|
| |
| int | fr_worker_close_event_insert (fr_worker_t *worker) |
| | Add events to the loop which will send close ack to the network.
|
| |
| fr_worker_config_t const * | fr_worker_config (fr_worker_t *worker) |
| |
| void | fr_worker_debug (fr_worker_t *worker, FILE *fp) |
| | Print debug information about the worker structure.
|
| |
| void | fr_worker_exit (fr_worker_t *worker) |
| | Tidy up a worker on normal exit.
|
| |
| int | fr_worker_listen_cancel (fr_worker_t *worker, fr_listen_instance_t const *li) |
| |
| void | fr_worker_post_event (fr_event_list_t *el, fr_time_t now, void *uctx) |
| |
| int | fr_worker_pre_event (fr_time_t now, fr_time_delta_t wake, void *uctx) |
| |
| int | fr_worker_request_timeout_set (fr_worker_t *worker, request_t *request, fr_time_delta_t timeout) |
| |
| void | fr_worker_shutting_down (fr_worker_t *worker) |
| | Tell the interpreter of the worker to cancel requests, instead of running them.
|
| |
| int | fr_worker_stats (fr_worker_t const *worker, int num, uint64_t *stats) |
| |
| int | fr_worker_subrequest_add (request_t *request) |
| |
Functions and data structures for worker threads.
- Id
- ddf0f29e17efa34776a213ded041367f0b70c99b
- Copyright
- 2016 Alan DeKok (aland.nosp@m.@fre.nosp@m.eradi.nosp@m.us.o.nosp@m.rg)
Definition in file worker.h.
◆ fr_worker_config_t
| struct fr_worker_config_t |
Definition at line 65 of file worker.h.
| Data Fields |
|
int |
max_channels |
maximum number of channels |
|
fr_time_delta_t |
max_request_time |
maximum time a request can be processed |
|
int |
max_requests |
max requests this worker will handle |
|
int |
message_set_size |
default start number of messages |
|
fr_slab_config_t |
reuse |
slab allocator configuration |
|
int |
ring_buffer_size |
default start size for the ring buffers |
◆ fr_worker_control_event_t
Events for a worker's own control messages, in the FR_CONTROL_EVENTSET_WORKER event set.
◆ fr_worker_t
A data structure to track the worker.
Once spawned, workers exist until they choose to exit.
Definition at line 44 of file worker.h.
◆ fr_worker_control_event_t
Events for a worker's own control messages, in the FR_CONTROL_EVENTSET_WORKER event set.
| Enumerator |
|---|
| FR_WORKER_CONTROL_LISTEN_DEAD | A listener has been closed.
|
Definition at line 35 of file worker.h.
◆ fr_worker()
◆ fr_worker_alloc()
Create a worker.
- Parameters
-
| [in] | ctx | the talloc context |
| [in] | name | the name of this worker |
| [in] | el | the event list |
| [in] | logger | the destination for all logging messages |
| [in] | lvl | log level |
| [in] | config | various configuration parameters |
- Returns
- NULL on error
- fr_worker_t on success
Definition at line 1260 of file worker.c.
◆ fr_worker_channel_create()
Create a channel to the worker.
Called by the master (i.e. network) thread when it needs to create a new channel to a particular worker.
- Parameters
-
| [in] | worker | the worker |
| [in] | ctx | the context in which the channel will be created |
| [in] | master | the control plane of the master |
| [in] | reply_ms | the message set the worker allocates replies from |
Definition at line 1653 of file worker.c.
◆ fr_worker_close_event_insert()
| int fr_worker_close_event_insert |
( |
fr_worker_t * |
worker | ) |
|
Add events to the loop which will send close ack to the network.
Definition at line 1581 of file worker.c.
◆ fr_worker_config()
◆ fr_worker_debug()
| void fr_worker_debug |
( |
fr_worker_t * |
worker, |
|
|
FILE * |
fp |
|
) |
| |
Print debug information about the worker structure.
- Parameters
-
| [in] | worker | the worker |
| [in] | fp | the file where the debug output is printed. |
Definition at line 1625 of file worker.c.
◆ fr_worker_exit()
Tidy up a worker on normal exit.
Definition at line 970 of file worker.c.
◆ fr_worker_listen_cancel()
◆ fr_worker_post_event()
◆ fr_worker_pre_event()
◆ fr_worker_request_timeout_set()
◆ fr_worker_shutting_down()
Tell the interpreter of the worker to cancel requests, instead of running them.
The single threaded scheduler calls this function before it detaches the thread data, so that the requests which the detach cancels do not go into the runnable heap of the worker. A worker thread does the same when the last input channel closes.
- Parameters
-
| [in] | worker | which is shutting down. |
Definition at line 1602 of file worker.c.
◆ fr_worker_stats()
| int fr_worker_stats |
( |
fr_worker_t const * |
worker, |
|
|
int |
num, |
|
|
uint64_t * |
stats |
|
) |
| |
◆ fr_worker_subrequest_add()
| int fr_worker_subrequest_add |
( |
request_t * |
request | ) |
|
◆ cmd_worker_table