I have a multi-threaded application where a thread sends a message to another thread. The waiting thread polls for the message and reacts (locks are handled). Like this:
You're doing busy waiting. You should never do that because it wastes CPU cycles. A thread or process waiting for some event should be in blocked state. Here are possible ways to achieve this: