POSIX Threads and signal masks
Posted
by
Max
on Stack Overflow
See other posts from Stack Overflow
or by Max
Published on 2012-10-28T22:58:00Z
Indexed on
2012/10/28
23:00 UTC
Read the original article
Hit count: 227
Is there a way to change the signal mask of a thread from another thread? I am supposed to write a multithreaded C application that doesn't use mutex, semaphores and condition variables, only signals.
So it would look like something like this: The main Thread sends SIGUSR1 to its process and and one of the 2 threads (not including the main thread), will respond to the signal and block SIGUSR1 from the sigmask and sleep. Then the main thread sends SIGUSR1 again, the other thread will respond, block SIGUSR1 from its sigmask, unblock SIGUSR1 from the other threads sigmask, so it will respond to SIGUSR1 again.
So essentially whenever the main thread sends SIGUSR1 the two other threads swap between each other.
Can somebody help?
© Stack Overflow or respective owner