???????????????????????????????????
???????????? ???????[ 2012/6/12 13:24:23 ] ????????
?????????????????????????????????????????????????????????????????????????????е?????????????????Щ?????????е????????????????????Щ???????????????????????????????????????????????????????Щ??????????????GUI??????????????????????????Щ????Щ???????????????????????????????????Щ????
typedef struct _TASK_INFO
{
UINT32 id;
UINT32* stack;
UINT32 size;
UINT32 context;
UINT32 priority;
UINT32 time_slice;
void (*func)();
}TASK_INFO;
?????????priority??????????????????????????????priority??????????time_slice??????????????
void reset_time_slice ()
{
int index;
for(index = 0; index < THREAD_MAX_NUMBER; index++)
gAllTask[index].time_slice = gAllTask[index].priority + 1;
}
??????????????ε??????????????????????????????????????????????????????????????????????????С??????????????????????????????????????????????????????????е??????
void signal_handler(int m)
{
int index;
start:
index = find_next_thread();
if(-1 == index)
{
reset_time_slice();
goto start;
}
gAllTask[index].time_slice --;
current_thread_id = index;
swap(&old?? &gAllTask[current_thread_id].context);
}
???????棬??????????????????????????????е?thread???
int find_next_thread()
{
int index;
for(index = THREAD_MAX_NUMBER -1; index >=0; index --)
{
if(0 != gAllTask[index].time_slice)
break;
}
return index;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11