PThreads and Timers

I have created a set of C++ class to wrap up PThread and Timers
among other stuff like Mutexes.

PThread and Mutex works fine alone.
Timer works fine alone.

But if I mix both, I got tons of problems weirder that doesn’t
happen on Linux or Solaris.

I often get “Memory Core Dump”,
or the thread cannot be start after the timer is created,
since pthread_create return an error saying there was a SYSCALL Interruption
during initialization… which never happens on Linux/Solaris.

If I start the timer after, the problem is then that the timer is never
used.
Since the 10 others threads created and joined are done with the task,
before it returns to the main().

For instance, if I have
p1
c1
c2
timer1

p1 will run until completion
c1/c2 will compete
timer1 will at the end run for x nanosec
and the program exit.

If I reduce p1, c1, c2 by setprio( 0, getprio(0) - 1 );
then let main get the same prio.

I got core dump after a while or immediately.

If I ask p1, c1, c2 to work intensively until the next timer x ms elapsed,
even with p1, c1, c2 have reduced priority,
what I obtain is 3 threads that runs infinitely
that are NOT KILLABLE or SLAYABLE !

If you press CTRL-C, CTRL-BREAK or anything similar,
the program doesn’t care and continue running infinetely.

If I close the window and say YES.

The program is still in sin/ps.

If I kill -9 or slay it, it still stay in memory.

If I open another terminal, guess what, I see the output of that program
still flooding the screen with status info infinetely.

If I open a 2nd terminal then I get a shell.

I have to reboot to get rid of those threads.

What is happening ?!!?

Any solution ?

Thanks alot !

Sincerly yours,
Fred.