|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
/****
|
|
|
|
|
* file threads.c
|
|
|
|
|
*
|
|
|
|
|
A partial implementation of a user-level thread package
|
|
|
|
|
A partial implementation of a user-level thread package
|
|
|
|
|
Written by Douglas Jones, Feb 17, 1998
|
|
|
|
|
Updated with minor bug fix in thread_exit, Feb 19, 1998
|
|
|
|
|
Updated so free called on original stack, Feb 19, 2002
|
|
|
|
@ -39,7 +39,7 @@
|
|
|
|
|
* This is the key to user-level context switching *
|
|
|
|
|
****/
|
|
|
|
|
/**** *
|
|
|
|
|
* tools used by studyit to understand jump buffer structure *
|
|
|
|
|
* tools used by studyit to understand jump buffer structure *
|
|
|
|
|
* ****/
|
|
|
|
|
static int * low_bound; /* below probe on stack */
|
|
|
|
|
static int * probe_local; /* local to probe on stack */
|
|
|
|
@ -64,7 +64,7 @@ jmp_buf probe_record; /* nonzero entries mean fields that change */
|
|
|
|
|
|
|
|
|
|
/****
|
|
|
|
|
* code to explore the activation record *
|
|
|
|
|
* and jump buffer structure *
|
|
|
|
|
* and jump buffer structure *
|
|
|
|
|
****/
|
|
|
|
|
void boundhigh()
|
|
|
|
|
/* purpose: set high_bound to a local variable beyond probe on stack */
|
|
|
|
@ -152,7 +152,7 @@ static void studyit()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p++, sameAR++, samePC++, probe_rec++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -195,7 +195,7 @@ void thread_startup_report()
|
|
|
|
|
****/
|
|
|
|
|
|
|
|
|
|
/**** *
|
|
|
|
|
* thread data types *
|
|
|
|
|
* thread data types *
|
|
|
|
|
* ****/
|
|
|
|
|
|
|
|
|
|
struct thread {
|
|
|
|
@ -229,7 +229,7 @@ static jmp_buf thread_death; /* used on thread package death */
|
|
|
|
|
static jmp_buf go_free_it; /* used to call free from original stk */
|
|
|
|
|
|
|
|
|
|
/**** *
|
|
|
|
|
* code for thread_queue data type *
|
|
|
|
|
* code for thread_queue data type *
|
|
|
|
|
* ****/
|
|
|
|
|
|
|
|
|
|
static void thread_queue_init( struct thread_queue * q )
|
|
|
|
@ -266,7 +266,7 @@ static struct thread * thread_dequeue( struct thread_queue * q )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**** *
|
|
|
|
|
* user callable thread management routines *
|
|
|
|
|
* user callable thread management routines *
|
|
|
|
|
* ****/
|
|
|
|
|
|
|
|
|
|
void thread_manager_init()
|
|
|
|
|