Since wait () will be returned once for each post () call, semaphores are the basic model of the producer-consumer - the simplest form of inter-thread message, with the possible exception of signals. They are used, so one thread can tell another thread that something happened, that it is interested (and how many times), and to control access to resources that can have no more than a fixed finite number of users. They offer custom warranties required for multi-threaded code.
, - " ". , "" . , . , , .
, , - , " ", . , "".
ReaderWriter - , , , , . , - . , ( , , ) , . ReaderWriter, , , - , .
, , , " ", , " " -, " " -. , , - ( - ).
, (, ) , ( , /) , . , , ( ) , ( , ).
Btw, # (, , " " ). , # , . , mutex/condition, .