mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-08-03 17:26:08 -04:00
Fix the lock
It was possible to loose some notifications
This commit is contained in:
parent
01f31441a1
commit
24b6eb4b1a
@ -50,8 +50,6 @@ struct deferred_unique_semaphore {
|
||||
scheduler::block_process_light(pid);
|
||||
lock.unlock();
|
||||
scheduler::reschedule();
|
||||
|
||||
waiting = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,10 +57,11 @@ struct deferred_unique_semaphore {
|
||||
* \brief Release the lock, from an IRQ handler.
|
||||
*/
|
||||
void notify() {
|
||||
if (!waiting) {
|
||||
++value;
|
||||
} else {
|
||||
if(waiting){
|
||||
scheduler::unblock_process_hint(pid);
|
||||
waiting = false;
|
||||
} else {
|
||||
++value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,15 +69,17 @@ struct deferred_unique_semaphore {
|
||||
* \brief Release the lock several times, from an IRQ
|
||||
*/
|
||||
void notify(size_t n) {
|
||||
if (!waiting) {
|
||||
value += n;
|
||||
} else {
|
||||
if (waiting) {
|
||||
scheduler::unblock_process_hint(pid);
|
||||
waiting = false;
|
||||
|
||||
--n;
|
||||
|
||||
if (n) {
|
||||
value += n;
|
||||
}
|
||||
} else {
|
||||
value += n;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user