Debugging threads with HP Wilde Beest
Starting program: /home/gdb/enh_thr_exit_no_join_detach
In thread 1
In thread 2
In thread 3
warning: Attempt to exit thread 4 which has neither been joined nor detached.
0x800003ffeffcc608 in __rtc_pthread_dummy+0 () from ../librtc64.sl
NOTE: A violation of this condition implies outstanding resources that are not released.
If the number of violations is small, or if they occur on an error path that causes abrupt
termination of the application, you can disable this check on threads.
TIP:
• You can modify the application so that the thread is joined or detached.
• If a thread is never cancelled, joined, or otherwise passed to threads API, it needs
to be detached. The thread can be explicitly joined or detached or created with the
detach attribute.
• If the thread is to be manipulated by a threads API, or the return value of threads
is to be considered, then the join operation should be performed to obtain the value
and destroy the thread.
Problem: The thread uses more than the specified percentage of the stack allocated to the thread.
Each thread is assigned a specific percentage of the stack when it is created. If the stack
allocation is not specified for a thread, the default value is used. The stack allocation
cannot be modified after a thread is created.
The application must ensure that the thread stack size is sufficient for all operations of
the thread. If a thread attempts to use more space than the allocated stack space, it
results in a stack overflow.
Consider the following example:
#include pthread.h
#include stdlib.h
#include stdio.h
#include errno.h
pthread_mutex_t job_lock = PTHREAD_MUTEX_INITIALIZER;
extern void fatal_error(int err, char *f);
void
my_thread()
{
int ret_val;
int more_stack[100];
static int count = 0;
sched_yield();
/* Acquire the associated mutex lock */
Modes of Thread debugging in HP WDB 35