c - What does it mean to send a message to a thread? -
i learning threads. , need understand how threads communicate between each other, mean when "let thread a
send message thread b
"?
i can think of following:
thread b
blocking on sort of queue, ,thread a
places new entry in queue, causesthread b
unblock, , retrieve entry.thread b
blocking on event (for example, in windows api there event object), ,thread a
signals event causethread b
wake (or called notifying thread , not sending message it?)
the "threads" world subject of many ambiguity due different nomenclature coming different environments, using same words mean different things.
your first assertion makes sense in general terms: "message" makes thread wake-up , "input".
depending on os , own api, second assertion makes sense , nothing more way implement first using win32 api.
another possible interpretation can thread blocked on message loop (see getmessage) , other 1 calls postthreadmessage.
in more general term, can think of "message" "event" carries "state" it: event happens (and that's information gives). message "happens", , has parameter associated it.
Comments
Post a Comment