Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the C# equivalence to Linux's signal mechanism?

I have two threads in my project, say thread A and thread B.

While thread B is busy doing something, I want to send a signal from thread A to thread B. After thread B receives the signal, it executes the corresponding signal handler immediately. In Linux, it is easy to do this with signal. To have the same effect, what should I do with C# threads?

like image 377
cooldfish Avatar asked Oct 25 '22 19:10

cooldfish


1 Answers

I don't know about signal in linux, but you can use ManualResetEvent to signal another thread.

like image 103
Daniel Hilgarth Avatar answered Oct 27 '22 10:10

Daniel Hilgarth