简体   繁体   中英

Is there any way to send signal to a thread from another process?

I want to send a signal from a process to a thread that is created from another process (that have not created the thread.

What I know about this that:

  • raise : sends signal to same process

  • pthread_kill can send singal to a thread from same prcess, ie that created that thread. you cannot use pthread_kill to send a signal to thread from another process.

  • kill sends signal to a process

Is there any way to send signal to a thread from another process?

Hope I am clear!!! NOTE: I am new to unix and threading

You Should Read About

  1. pthread_signal()

Should set you in the right direction

There is an appropriately named tkill(2) :

 tkill, tgkill - send a signal to a thread tgkill() sends the signal sig to the thread with the thread ID tid 

You can get a tid using gettid(2) .


Beware: the concept of a TID and therefore everything having to do with one is Linux-specific.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM