From 5f42ef3c92b3a1f5679e92ba3b2bb3a547c16da2 Mon Sep 17 00:00:00 2001 From: Sebastian Kloska Date: Tue, 10 Sep 2019 14:25:34 +0200 Subject: Proper setup and error checking of pthread_create * Replace all start_XXX functions with one start_thread * Don't make pthread_t static * Don't use pthread_attr_t. Simply pass NULL * Bail out when pthread_create() fails * Check if MAX_THREADS gets exceeded Signed-off-by: Sebastian Kloska --- src/system/dlt-system.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/system/dlt-system.h') diff --git a/src/system/dlt-system.h b/src/system/dlt-system.h index 46738b8..e60cb9b 100644 --- a/src/system/dlt-system.h +++ b/src/system/dlt-system.h @@ -175,23 +175,25 @@ int read_configuration_file(DltSystemConfiguration *config, char *file_name); /* In dlt-process-handling.c */ int daemonize(); void start_threads(DltSystemConfiguration *config); +void start_thread(DltSystemConfiguration *conf, + void (thread)(void *), const char *nam); void join_threads(); void dlt_system_signal_handler(int sig); void register_with_dlt(DltSystemConfiguration *config); -/* Thread initiators: */ +/* Threads */ void init_shell(); -void start_syslog(); -void start_filetransfer(DltSystemConfiguration *conf); -void start_logfile(DltSystemConfiguration *conf); -void start_logprocess(DltSystemConfiguration *conf); +void syslog_thread(void *v_conf); +void filetransfer_thread(void *v_conf); +void logfile_thread(void *v_conf); +void logprocess_thread(void *v_conf); #if defined(DLT_SYSTEMD_WATCHDOG_ENABLE) -void start_systemd_watchdog(DltSystemConfiguration *conf); +void watchdog_thread(void *v_conf); #endif #if defined(DLT_SYSTEMD_JOURNAL_ENABLE) -void start_systemd_journal(DltSystemConfiguration *conf); +void journal_thread(void *v_conf); #endif #endif /* DLT_SYSTEM_H_ */ -- cgit v1.2.1