() () . , , . ( ).
(, ), . (, , ).
( ), ( ), ( ) .
, . , , , .
, , .
, , . , .
Windows CriticalSection. , . CriticalSection :
CRITICAL_SECTION cs;
InitializeCriticalSection(&cs);
EnterCriticalSection(&cs);
//
LeaveCriticalSection(&cs);
DeleteCriticalSection(&cs);
EnterCriticalSection . , . , . , , , .
: Event, Mutex, Semaphore, WaitableTimer. .
|
|
WaitForSingleObject(), WaitForMultipleObjects() . (signaled).
(Event) . CreateEvent() : . OpenEvent(). ( signaled) SetEvent(), , ResetEvent(), Wait-. PulseEvent() , . , Event -.
(Mutex) . , , , . CriticalSection, Mutex , . CreateMutex(), OpenMutex(), ReleaseMutex(), Wait-.
(Semaphore) , . , . . , . CreateSemaphore(), OpenSemaphore(), () ReleaseSemaphore(), , Wait-.
Wait- , :
;
, .
1. .
2. Win 32.
3. CriticalSection, .
4. WaitForSingleObject, . .
5. Event, , . .
6. Event .
7. Mutex, , . .
8. Semaphore, , . . .
9. CriticalSection Event, Mutex, Semaphore.
. : , ; , ; , , - ( ), . , .
|
|
12.3.1. : , . . Event, CriticalSection.
12.3.2. : , . . Mutex, Semaphore.
12.3.3. Edit. Edit : First, Second Third. Event, CriticalSection.
4. Edit. Edit : String1, String2, String3. Mutex, Semaphore.
12.3.5. ( ). : , . Event, CriticalSection.
12.3.6. . : , . Mutex, Semaphore.
12.3.7. , : AAAA, BBBB, CCCC, DDDD. Event, CriticalSection.
12.3.8. , : XXXX, ZZZZ, TTTT, YYYY. Mutex, Semaphore.
12.3.9. , : , , . Event, CriticalSection.
12.3.10. , : , , . Mutex, Semaphore.
12.3.11. ListBox. , ListBox : First Second. ListBox Event, CriticalSection.
12.3.12. ListBox. , ListBox : First Second. ListBox Mutex, Semaphore.
12.3.13. , . . Event, CriticalSection.
12.3.14. , . . Semaphore.
12.3.15. , . . . Semaphore.
|
|
13
:
1) ;
2) Windows;
3) .