5. Predavanje - VTS NS
5. Predavanje - VTS NS
5. Predavanje - VTS NS
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Upotreba semaforaOgraničeni bafer pomoću semafora:const int N = ...; // Capacity of the bufferclass Data;class BoundedBuffer {public:BoundedBuffer ();void append (Data*);Data* take ();private:Semaphore mutex;Semaphore spaceAvailable, itemAvailable;Data* buffer[N];int head, tail;};75/285