Implement userspace TLS, remove RW Locks

This commit is contained in:
2026-01-28 23:52:48 +01:00
parent a3b62ebd3d
commit 3d23187acf
17 changed files with 135 additions and 157 deletions

View File

@@ -8,7 +8,7 @@
#define MUTEX 2000
/* __thread char letter; */
__thread char letter = 'c';
void app_thread1 (void);
@@ -25,30 +25,30 @@ int spawn (void (*fn) (void)) {
void app_main (void) {
mutex_create (MUTEX);
/* letter = 'd'; */
letter = 'a';
spawn (&app_thread1);
for (;;) {
/* mutex_lock (MUTEX); */
mutex_lock (MUTEX);
/* for (int i = 0; i < 3; i++) */
/* test (letter); */
for (int i = 0; i < 3; i++)
test (letter);
/* mutex_unlock (MUTEX); */
mutex_unlock (MUTEX);
}
}
void app_thread1 (void) {
/* letter = 'c'; */
letter = 'b';
for (;;) {
/* mutex_lock (MUTEX); */
mutex_lock (MUTEX);
/* for (int i = 0; i < 3; i++) */
/* test (letter); */
for (int i = 0; i < 3; i++)
test (letter);
/* mutex_unlock (MUTEX); */
mutex_unlock (MUTEX);
}
quit ();