Merge branch 'develop' into poll

This commit is contained in:
Ian Craggs 2022-02-07 10:29:45 +00:00
commit 17743e910e
3 changed files with 17 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2020 IBM Corp.
* Copyright (c) 2009, 2022 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@ -86,7 +86,7 @@ typedef struct
#endif
int sametime_count;
int number;
int thread_id;
thread_id_type thread_id;
int depth;
char name[MAX_FUNCTION_NAME_LENGTH + 1];
int line;
@ -453,7 +453,7 @@ void Log(enum LOG_LEVELS log_level, int msgno, const char *format, ...)
* @param aFormat the printf format string to be used if the message id does not exist
* @param ... the printf inserts
*/
void Log_stackTrace(enum LOG_LEVELS log_level, int msgno, int thread_id, int current_depth, const char* name, int line, int* rc)
void Log_stackTrace(enum LOG_LEVELS log_level, int msgno, thread_id_type thread_id, int current_depth, const char* name, int line, int* rc)
{
traceEntry *cur_entry = NULL;

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2022 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@ -18,6 +18,14 @@
#if !defined(LOG_H)
#define LOG_H
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#define thread_id_type DWORD
#else
#include <pthread.h>
#define thread_id_type pthread_t
#endif
/*BE
map LOG_LEVELS
{
@ -76,7 +84,7 @@ int Log_initialize(Log_nameValue*);
void Log_terminate(void);
void Log(enum LOG_LEVELS, int, const char *, ...);
void Log_stackTrace(enum LOG_LEVELS, int, int, int, const char*, int, int*);
void Log_stackTrace(enum LOG_LEVELS, int, thread_id_type, int, const char*, int, int*);
typedef void Log_traceCallback(enum LOG_LEVELS level, const char *message);
void Log_setTraceCallback(Log_traceCallback* callback);

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2020 IBM Corp.
* Copyright (c) 2009, 2022 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@ -109,7 +109,7 @@ void StackTrace_entry(const char* name, int line, enum LOG_LEVELS trace_level)
if (!setStack(1))
goto exit;
if (trace_level != -1)
Log_stackTrace(trace_level, 9, (int)my_thread->id, my_thread->current_depth, name, line, NULL);
Log_stackTrace(trace_level, 9, my_thread->id, my_thread->current_depth, name, line, NULL);
strncpy(my_thread->callstack[my_thread->current_depth].name, name, sizeof(my_thread->callstack[0].name)-1);
my_thread->callstack[(my_thread->current_depth)++].line = line;
if (my_thread->current_depth > my_thread->maxdepth)
@ -133,9 +133,9 @@ void StackTrace_exit(const char* name, int line, void* rc, enum LOG_LEVELS trace
if (trace_level != -1)
{
if (rc == NULL)
Log_stackTrace(trace_level, 10, (int)my_thread->id, my_thread->current_depth, name, line, NULL);
Log_stackTrace(trace_level, 10, my_thread->id, my_thread->current_depth, name, line, NULL);
else
Log_stackTrace(trace_level, 11, (int)my_thread->id, my_thread->current_depth, name, line, (int*)rc);
Log_stackTrace(trace_level, 11, my_thread->id, my_thread->current_depth, name, line, (int*)rc);
}
exit:
Thread_unlock_mutex(stack_mutex);