13.07.2015 Views

5. Predavanje - VTS NS

5. Predavanje - VTS NS

5. Predavanje - VTS NS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Implementacija semaforavoid Semaphore::block () {if (setjmp(Thread::runningThread->context)==0) {// Blocking:blocked->put(Thread::runningThread);Thread::runningThread = Scheduler::get();longjmp(Thread::runningThread->context);} else return;}void Semaphore::deblock () {// Deblocking:Thread* t = blocked->get();Scheduler::put(t);}65/285

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!