threads and signals

can any one give me an example of a concurrency program in threads and signals, i.e how to deliver messages between threads using signals. thanks

The only thread-control call safe to use in a signal handler is sem_post. A signal handler could use this to release a thread from wait state.

I strongly advise you not to try and use OS signals to deliver messages between threads if you are using pthreads. Use condition variables instead.

pthread_cond_wait() blocks the calling thread until the specified condition is signalled. 

pthread_cond_signal() is used to signal (or wake up) another thread which is waiting on the condition variable. 

pthread_cond_broadcast() should be used instead of pthread_cond_signal() if more than one thread is in a blocking wait state.