Clean up AMD64 memory management code, remove dependency on pd.lock
This commit is contained in:
22
init/init.c
22
init/init.c
@@ -8,6 +8,8 @@
|
||||
|
||||
#define MUTEX 2000
|
||||
|
||||
/* __thread char letter; */
|
||||
|
||||
void app_thread1 (void);
|
||||
|
||||
int spawn (void (*fn) (void)) {
|
||||
@@ -23,26 +25,30 @@ int spawn (void (*fn) (void)) {
|
||||
void app_main (void) {
|
||||
mutex_create (MUTEX);
|
||||
|
||||
/* letter = 'd'; */
|
||||
|
||||
spawn (&app_thread1);
|
||||
|
||||
for (;;) {
|
||||
mutex_lock (MUTEX);
|
||||
/* mutex_lock (MUTEX); */
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
test ('a');
|
||||
/* for (int i = 0; i < 3; i++) */
|
||||
/* test (letter); */
|
||||
|
||||
mutex_unlock (MUTEX);
|
||||
/* mutex_unlock (MUTEX); */
|
||||
}
|
||||
}
|
||||
|
||||
void app_thread1 (void) {
|
||||
/* letter = 'c'; */
|
||||
|
||||
for (;;) {
|
||||
mutex_lock (MUTEX);
|
||||
/* mutex_lock (MUTEX); */
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
test ('b');
|
||||
/* for (int i = 0; i < 3; i++) */
|
||||
/* test (letter); */
|
||||
|
||||
mutex_unlock (MUTEX);
|
||||
/* mutex_unlock (MUTEX); */
|
||||
}
|
||||
|
||||
quit ();
|
||||
|
||||
Reference in New Issue
Block a user