1

synchronize with semaphore

This commit is contained in:
2022-07-11 15:37:45 +02:00
parent 66b3b914d0
commit 597b823ac3
3 changed files with 15 additions and 7 deletions

View File

@ -6,12 +6,12 @@ void PreemptiveLoopThread::run() {
int cnt = 0;
while (true) {
// Basic synchronization by disabling PIT interrupts
cpu.disable_int();
// Basic synchronization by semaphore
sem->p();
kout.setpos(55, this->id);
kout << this->id << ": " << dec << cnt++ << endl;
cpu.enable_int();
sem->v();
}
}