Skip to content

Commit

Permalink
uses TTAS instead TAS
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Feb 17, 2024
1 parent 95fd930 commit 8ccbbf3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions noson/src/private/os/threads/latch.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ namespace OS

void spin_lock()
{
for (;;)
while (s_spin.increment() != 1)
{
if (s_spin.load() == 0 && s_spin.increment() == 1)
break;
sched_yield();
do
{
sched_yield();
} while (s_spin.load() != 0);
}
}
void spin_unlock() { s_spin.store(0); }
Expand Down

0 comments on commit 8ccbbf3

Please sign in to comment.