.


:




:

































 

 

 

 





Windows , . , , 2? , , , . , , (deadlock) .

/* hsem . 2. */

/* 2. */

WaitForSingleObject(hSem, INFINITE);

WaitForSingleObject(hSem, INFINITE);

/* 2. */

ReleaseSemaphore(hSem, 2, &PrevCount);

, , , 2 , . 0. , . .

, CRITI-CAL_SECTION, :

/* 2. */

EnterCriticalSection(&csSem);

WaitForSingleObject(hSem, INFINITE);

WaitForSingleObject(hSem, INFINITE);

LeaveCriticalSection (&csSem);

ReleaseSemaphore(hSem, 2, &PrevCount);

, , . , , , , . , , . , , - .

, WaitForMultipleObjects . . , , , WaitForMultipleObjects . , 1, , .

10.11.

Windows , (atomic multiple-wait operation).





:


: 2015-09-20; !; : 398 |


:

:

: , .
==> ...

1336 - | 942 -


© 2015-2024 lektsii.org - -

: 0.008 .