#include "vxWorks.h"
#include "taskLib.h"
#include "taskHookLib.h" /* taskHook所對應的庫 */
void myFunc(void)
{
int i;
printf("Hello, I am task %d\n", taskIdSelf()); /* Print task Id */
}
void myTaskHook(void)
{
printf("task hook function called\n");
}
void user_start()
{
taskCreateHookAdd( (FUNCPTR) myTaskHook);
taskSpawn("myTask", 90, 0x100, 2000, (FUNCPTR) myFunc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
運行輸出:
task hook function called
Hello, I am task 14868640