#include<stdio.h>
typedef void (*demo_test_func)(void);
int guTestFlag = 0;
/*****************************/
void usleep(int countTime);
void demo_call_test1_msg(void);
void demo_call_test1_msg(void);
void check_test_flag(void);
/*****************************/
void demo_call_test1_msg(void){
guTestFlag = 1;
printf("send test1 message!\n");
}
void demo_call_test2_msg(void){
guTestFlag = 2;
printf("send test2 message!\n");
}
void demo_test1_pro(void){
guTestFlag = 0;
printf("demo test1!\n");
}
void demo_test2_pro(void){
guTestFlag = 0;
printf("demo test1!\n");
}
void check_test_flag(void){
switch(guTestFlag){
case 1:
demo_test1_pro();
break;
case 2:
demo_test1_pro();
break;
default:
printf("error flag!\n");
break;
}
}
demo_test_func TEST_FUNC_TABLE[2]={
demo_call_test1_msg,
demo_call_test2_msg
};
void test_schd(void){
int test_flag = 0;
demo_test_func *demo_test_func_ptr;
demo_test_func_ptr = &TEST_FUNC_TABLE[0];
(*demo_test_func_ptr)();
check_test_flag();
demo_test_func_ptr++;
(*demo_test_func_ptr)();
printf("flag = %d\n",guTestFlag);
}
int main(int argc,char **argv){
test_schd();
return 0;
}
void usleep(int countTime){
int i = 0;
for(i = 0;i < countTime;i++){
};
}