0

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, i.e 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

iDebD_gh
  • 364
  • 5
  • 18

2 Answers2

1

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.

cnicutar
  • 178,505
  • 25
  • 365
  • 392
0

You Should Read About

  1. pthread_signal()

Should set you in the right direction

Ansh David
  • 654
  • 1
  • 10
  • 26