Enrico Simetti
|
Sending signal from process A to a specific Process B's thread
|
Enrico Simetti
07/03/2009 2:27 PM
post33092
|
Sending signal from process A to a specific Process B's thread
Hello,
I'm currently writing a portable framework for RT-related programs, which should support RTAI, VxWorks, RTEMS and of
course QNX Neutrino.
The problem that I'm currently trying to solve and that I'm having some difficulties to find a proper solution for QNX
is this: Process A need to signal a specific thread of Process B. I know about sigaction/kill for processes, and I know
of pthread_kill for signaling between threads of same the same process. I've tried under Linux to use pthread_kill
between threads of different processes but all I got was a segfault on the 'killer' side.
I've however found a solution for Linux which is the following: process B saves in a shared memory are its PID and all
its threads do the same for their respectiveTID (obtained using gettid() - which is NOT the same number as
pthread_self() ).
Now process A can simply read the shared memory and signal a specific thread of process B using: tgkill(pid, tid, signo)
which is a syscall that sends signal 'signo' to a thread 'tid' that must belong to process 'pid'.
Using the same procedure i.e. saving the pthread_self() results in the shared memory and then using
pthread_kill(pthread_id) on process A side yielded a segfault.
Anyone has any tips or even a solution?
Thanks for all the help
Enrico
|
|
|