snapshot before regression test

This commit is contained in:
t
2026-07-18 19:25:40 +08:00
commit 796222a300
2295 changed files with 206453 additions and 0 deletions

18
includes/spinlock.py Normal file
View File

@@ -0,0 +1,18 @@
import t, c
import atom
@t.Object
class _spinlock:
locked: t.CVolatile | t.CInt
name: t.CArray[t.CChar, 32]
def __init__(self):
self.locked = 0
def lock(self):
while atom.__atomic_test_and_set(c.Addr(self.locked), atom.ATOMIC_ACQUIRE):
pass
def unlock(self):
atom.__atomic_clear(c.Addr(self.locked), atom.ATOMIC_RELEASE)