Go to the source code of this file.
◆ MAIN_LOOP_ERROR
◆ MainLoopTaskFunc
| typedef gpointer(* MainLoopTaskFunc) (gpointer user_data) |
◆ MainLoopError
| Enumerator |
|---|
| MAIN_LOOP_ERROR_FAILED | |
| MAIN_LOOP_ERROR_RELOAD_FAILED | |
◆ main_loop_add_options()
| void main_loop_add_options |
( |
GOptionContext * |
ctx | ) |
|
◆ main_loop_deinit()
| void main_loop_deinit |
( |
MainLoop * |
self | ) |
|
◆ main_loop_error_quark()
| GQuark main_loop_error_quark |
( |
void |
| ) |
|
◆ main_loop_exit()
| void main_loop_exit |
( |
MainLoop * |
self | ) |
|
◆ main_loop_get_current_config()
| GlobalConfig* main_loop_get_current_config |
( |
MainLoop * |
self | ) |
|
◆ main_loop_get_instance()
| MainLoop* main_loop_get_instance |
( |
void |
| ) |
|
◆ main_loop_get_pending_new_config()
| GlobalConfig* main_loop_get_pending_new_config |
( |
MainLoop * |
self | ) |
|
◆ main_loop_init()
◆ main_loop_initialize_state()
| gboolean main_loop_initialize_state |
( |
GlobalConfig * |
cfg, |
|
|
const gchar * |
persist_filename |
|
) |
| |
◆ main_loop_is_control_server_running()
| gboolean main_loop_is_control_server_running |
( |
MainLoop * |
self | ) |
|
◆ main_loop_is_server_mode()
| gboolean main_loop_is_server_mode |
( |
MainLoop * |
self | ) |
|
◆ main_loop_is_terminating()
| gboolean main_loop_is_terminating |
( |
MainLoop * |
self | ) |
|
◆ main_loop_read_and_init_config()
| int main_loop_read_and_init_config |
( |
MainLoop * |
self | ) |
|
◆ main_loop_reload_config()
| void main_loop_reload_config |
( |
MainLoop * |
self | ) |
|
◆ main_loop_reload_config_commence()
| void main_loop_reload_config_commence |
( |
MainLoop * |
self | ) |
|
◆ main_loop_reload_config_prepare()
| gboolean main_loop_reload_config_prepare |
( |
MainLoop * |
self, |
|
|
GError ** |
error |
|
) |
| |
◆ main_loop_run()
| void main_loop_run |
( |
MainLoop * |
self | ) |
|
◆ main_loop_set_server_mode()
| void main_loop_set_server_mode |
( |
MainLoop * |
self, |
|
|
gboolean |
server_mode |
|
) |
| |
◆ main_loop_thread_resource_deinit()
| void main_loop_thread_resource_deinit |
( |
void |
| ) |
|
◆ main_loop_thread_resource_init()
| void main_loop_thread_resource_init |
( |
void |
| ) |
|
◆ main_loop_verify_config()
| void main_loop_verify_config |
( |
GString * |
result, |
|
|
MainLoop * |
self |
|
) |
| |
◆ main_loop_was_last_reload_successful()
| gboolean main_loop_was_last_reload_successful |
( |
MainLoop * |
self | ) |
|
◆ main_loop_workers_running
| volatile gint main_loop_workers_running |
|
extern |
◆ main_thread_handle
Processing model
This comment documents how the work performed by syslog-ng is partitioned between threads. First of all it is useful to know that the configuration is translated to a tree of LogPipe instances, as described in a comment in logpipe.h.
The basic assumptions for threading:
- configuration file is parsed in the main thread
- the log pipe tree is built in the main thread
- processing of messages is stalled while the configuration is reloaded
- the _queue() operation for LogPipe instances can happen in multiple threads
- notifications across LogPipe instances happen in the main thread
This boils down to:
- If not otherwise specified LogPipe derived classes can only be instantiated (e.g. new()) or initialized/deinitialized (_init/deinit) in the main thread. Exceptions to this rule are documented below.
- All queue operations finish before either deinit is called.
- Locking is only needed between multiple invocations of _queue() in parallel threads, and any other main thread activity.
Threading model
- the main thread manages the configuration and polls for I/O using epoll
- whenever an I/O event happens, work may be delegated to worker threads. Currently only the LogReader/LogWriter classes make use of worker threads, everything else remains in the main thread (internal messages, incoming connections, etc).
- all I/O polling must be registered in the main thread (update_watches and friends)
◆ thread_halt_cond
◆ workers_running_lock
| GMutex workers_running_lock |
|
extern |