diff options
-rw-r--r-- | daemons/maap/linux/src/maap_log_linux.c | 17 | ||||
-rw-r--r-- | daemons/shaper/src/shaper_log_linux.c | 16 | ||||
-rw-r--r-- | lib/avtp_pipeline/platform/Linux/openavb_tasks.h | 10 |
3 files changed, 36 insertions, 7 deletions
diff --git a/daemons/maap/linux/src/maap_log_linux.c b/daemons/maap/linux/src/maap_log_linux.c index 2d6f02b3..35dcfcbc 100644 --- a/daemons/maap/linux/src/maap_log_linux.c +++ b/daemons/maap/linux/src/maap_log_linux.c @@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdarg.h> #include <string.h> #include <inttypes.h> +#include <limits.h> #include "platform.h" #include "maap_log_queue.h" @@ -74,7 +75,14 @@ extern void *loggingThreadFn(void *pv); THREAD_TYPE(loggingThread); THREAD_DEFINITON(loggingThread); -#define THREAD_STACK_SIZE 65536 +#if !defined(PTHREAD_STACK_MIN) +#error "PTHREAD_STACK_MIN variable not defined" +#elif (PTHREAD_STACK_MIN > 65536) +#define THREAD_STACK_SIZE PTHREAD_STACK_MIN +#else +#define THREAD_STACK_SIZE 65536 +#endif + #define loggingThread_THREAD_STK_SIZE THREAD_STACK_SIZE static MUTEX_HANDLE_ALT(gLogMutex); @@ -211,13 +219,16 @@ void maapLogInit(void) loggingThreadRunning = TRUE; THREAD_CREATE(loggingThread, loggingThread, NULL, loggingThreadFn, NULL); THREAD_CHECK_ERROR(loggingThread, "Thread / task creation failed", errResult); - if (errResult); // Already reported + if (errResult) { + loggingThreadRunning = FALSE; + MAAP_LOG_ERROR("Could not log data: loggingThread create failure"); + } } } void maapLogExit() { - if (MAAP_LOG_FROM_THREAD) { + if (MAAP_LOG_FROM_THREAD && loggingThreadRunning ) { loggingThreadRunning = FALSE; THREAD_JOIN(loggingThread, NULL); } diff --git a/daemons/shaper/src/shaper_log_linux.c b/daemons/shaper/src/shaper_log_linux.c index d68a79a2..38017c38 100644 --- a/daemons/shaper/src/shaper_log_linux.c +++ b/daemons/shaper/src/shaper_log_linux.c @@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdarg.h> #include <string.h> #include <inttypes.h> +#include <limits.h> #include "platform.h" #include "shaper_log_queue.h" @@ -74,7 +75,13 @@ extern void *loggingThreadFn(void *pv); THREAD_TYPE(loggingThread); THREAD_DEFINITON(loggingThread); -#define THREAD_STACK_SIZE 65536 +#if !defined(PTHREAD_STACK_MIN) +#error "PTHREAD_STACK_MIN variable not defined" +#elif (PTHREAD_STACK_MIN > 65536) +#define THREAD_STACK_SIZE PTHREAD_STACK_MIN +#else +#define THREAD_STACK_SIZE 65536 +#endif #define loggingThread_THREAD_STK_SIZE THREAD_STACK_SIZE static MUTEX_HANDLE_ALT(gLogMutex); @@ -217,13 +224,16 @@ void shaperLogInit(void) loggingThreadRunning = TRUE; THREAD_CREATE(loggingThread, loggingThread, NULL, loggingThreadFn, NULL); THREAD_CHECK_ERROR(loggingThread, "Thread / task creation failed", errResult); - if (errResult) {} // Already reported + if (errResult) { + loggingThreadRunning = FALSE; + SHAPER_LOG_ERROR("Could not log data: loggingThread create failure"); + } } } void shaperLogExit() { - if (SHAPER_LOG_FROM_THREAD) { + if (SHAPER_LOG_FROM_THREAD && loggingThreadRunning) { loggingThreadRunning = FALSE; THREAD_JOIN(loggingThread, NULL); } diff --git a/lib/avtp_pipeline/platform/Linux/openavb_tasks.h b/lib/avtp_pipeline/platform/Linux/openavb_tasks.h index 01969f09..387fd985 100644 --- a/lib/avtp_pipeline/platform/Linux/openavb_tasks.h +++ b/lib/avtp_pipeline/platform/Linux/openavb_tasks.h @@ -32,7 +32,15 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. #ifndef _EAVBTASKS_H #define _EAVBTASKS_H -#define THREAD_STACK_SIZE 65536 +#include <limits.h> + +#if !defined(PTHREAD_STACK_MIN) +#error "PTHREAD_STACK_MIN variable not defined" +#elif (PTHREAD_STACK_MIN > 65536) +#define THREAD_STACK_SIZE PTHREAD_STACK_MIN +#else +#define THREAD_STACK_SIZE 65536 +#endif /////////////////////////// // Platform code Tasks values |