添加debug,每个线程都维护一个jump帧
This commit is contained in:
15
main.c
15
main.c
@@ -5,10 +5,11 @@
|
||||
#include "soft/exception.h"
|
||||
#include "soft/mythread.h"
|
||||
#include "unistd.h"
|
||||
#include "soft/debug.h"
|
||||
|
||||
|
||||
int thread_fun(void *t){
|
||||
printf("run in thread_fun.\n");
|
||||
DBG_INFO("run in thread_fun.\n");
|
||||
|
||||
while(1){
|
||||
sleep(5);
|
||||
@@ -22,8 +23,8 @@ int thread_fun(void *t){
|
||||
void SystemInit();
|
||||
extern char **environ;
|
||||
int main(int argc,char *argv[]){
|
||||
int id;
|
||||
printf("hello world.\n");
|
||||
debug_init(NULL);
|
||||
DBG_INFO("hello world.%ld\n",(size_t)pthread_self());
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +34,8 @@ int main(int argc,char *argv[]){
|
||||
// }
|
||||
|
||||
// printf("a+b=%d",test_add(3,5));
|
||||
id=myth_create(thread_fun,NULL);
|
||||
id=myth_create(NULL,NULL);
|
||||
myth_create(thread_fun,NULL);
|
||||
myth_create(NULL,NULL);
|
||||
// sleep(10);
|
||||
myth_join();
|
||||
}
|
||||
@@ -56,11 +57,11 @@ typedef void (*slot_fun_def)(size_t a,size_t b,size_t c,size_t d,size_t e,size_t
|
||||
|
||||
|
||||
void funptr_test(){
|
||||
printf("print from funptr_test fun.\n");
|
||||
DBG_INFO("print from funptr_test fun.\n");
|
||||
}
|
||||
|
||||
void add_test(int a,int b,void (*f)()){
|
||||
printf("add_fun:%d+%d=%d\n",a,b,a+b);
|
||||
DBG_INFO("add_fun:%d+%d=%d\n",a,b,a+b);
|
||||
f();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user