Hi,
we have difficulties to stop and continue threads of a process.
The problem is that pthread_kill(thread_id, SIGTSTP) stops also the
calling main thread of the process.
Is possible to correct that signal handling in 6.2 ??
Regards
Armin
here the details … code below.
sigtest
thread start …
[1] + Stopped sigtest
→ strange behavior of the shell …
pidin | grep sigtest
802856 1 ./sigtest 10o STOPPED
802856 2 ./sigtest 10o STOPPED
→ also the main thread 1 stops …
kill -25 802856
thread started … 2
kill -25 802856
→ signal SIGCONT send to the process
[1] + Stopped sigtest ???
thread continued … ???
kill -25 802856
[1] + Stopped sigtest
Here is the example code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <termios.h>
#include <pthread.h>
#include <sys/neutrino.h>
pthread_t thread_id;
int resume;
void * thread1 (void *arg)
{
for(;
{
// thread stops by itself
pthread_kill( thread_id, SIGTSTP);
}
}
int main(int argc, char **argv)
{
// allow access to IO resources
ThreadCtl(_NTO_TCTL_IO, 0);
// Start the thread.
printf(" thread start … \n");
pthread_create (&thread_id, NULL,thread1, NULL);
printf(" thread started … %d \n", thread_id);
for(;
{
pthread_kill( thread_id, SIGCONT);
printf(" thread continued …\n");
}
return (0);
}