简体   繁体   English

有什么方法可以将信号从另一个进程发送到线程吗?

[英]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. pthread_kill可以从同一进程(即创建该线程的进程)向线程发送信号。 you cannot use pthread_kill to send a signal to thread from another process. 您不能使用pthread_kill从另一个进程向线程发送信号。

  • 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 注意:我是不熟悉Unix和线程技术的

You Should Read About 您应该阅读有关

  1. pthread_signal()

Should set you in the right direction 应该为您设定正确的方向

There is an appropriately named tkill(2) : 有一个适当命名的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) . 您可以使用gettid(2)


Beware: the concept of a TID and therefore everything having to do with one is Linux-specific. 当心:TID的概念,因此与TID有关的一切都是特定于Linux的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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