Implement userspace TLS, remove RW Locks
This commit is contained in:
22
init/init.c
22
init/init.c
@@ -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 ();
|
||||
|
||||
Reference in New Issue
Block a user