To prevent a possible race condition, when fetching a ticket and being interrupted by an IRQ Handler that also fetches a ticket, we need to disable interrupts before fetching a ticket.
As discussed, I originally wanted to tackle this problem by implementing recursive spinlocks, just like in the C version of HermitCore. However, they would have also required disabling interrupts before fetching a ticket to be absolutely safe from race conditions. When interrupts are disabled early in obtain_lock() though, no recursive locking situation can happen inside eduOS-rs, so we can solve the race condition without introducing recursive spinlocks.
To prevent a possible race condition, when fetching a ticket and being interrupted by an IRQ Handler that also fetches a ticket, we need to disable interrupts before fetching a ticket.
As discussed, I originally wanted to tackle this problem by implementing recursive spinlocks, just like in the C version of HermitCore. However, they would have also required disabling interrupts before fetching a ticket to be absolutely safe from race conditions. When interrupts are disabled early in obtain_lock() though, no recursive locking situation can happen inside eduOS-rs, so we can solve the race condition without introducing recursive spinlocks.