mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-08-04 01:36:10 -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);
|
scheduler::block_process_light(pid);
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
scheduler::reschedule();
|
scheduler::reschedule();
|
||||||
|
|
||||||
waiting = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,10 +57,11 @@ struct deferred_unique_semaphore {
|
|||||||
* \brief Release the lock, from an IRQ handler.
|
* \brief Release the lock, from an IRQ handler.
|
||||||
*/
|
*/
|
||||||
void notify() {
|
void notify() {
|
||||||
if (!waiting) {
|
if(waiting){
|
||||||
++value;
|
|
||||||
} else {
|
|
||||||
scheduler::unblock_process_hint(pid);
|
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
|
* \brief Release the lock several times, from an IRQ
|
||||||
*/
|
*/
|
||||||
void notify(size_t n) {
|
void notify(size_t n) {
|
||||||
if (!waiting) {
|
if (waiting) {
|
||||||
value += n;
|
|
||||||
} else {
|
|
||||||
scheduler::unblock_process_hint(pid);
|
scheduler::unblock_process_hint(pid);
|
||||||
|
waiting = false;
|
||||||
|
|
||||||
--n;
|
--n;
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
value += n;
|
value += n;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
value += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user