linux how to notify another thread to execute a call back function

i come cross a problem,
thread1 : monitor io
thread2 : user thread.

when thread1 receive some data, how to notify thread2 to execute the function(this call back function is implemented by user.).
1. signal: i can not guarantee call back function can not use signal safe function, so signal is not appropriate
2. message queue: mq_notify : is notified only when a new message arrives on a queue that was previously empty. so message queue is not appropriate.

could anybody give me a pretty solution?

thank you very much.

Source: linux

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.