The function tries to send a message, but gives up if the timeout elapses. What exactly happens when the timeout elapses?
It depends.
The first case is if the receiving thread never received the message at all. (I.e., if during the period the sender is waiting, the receiving thread never called , , or a similar message-retrieval function ...