Porting Applications 187
We define a new structure uarg_t that holds all the RTOS task entry
routine arguments, the pointer to the entry routine, and the priority of the task.
typedef struct _uarg_t {
rtosEntry_t entry_routine;
int priority;
char *arg1;
int arg2;
void *arg3;
}uarg_t;
For every call to rtosCreateTask a new thread of execution is created
by calling the
pthread_create function. The identifier of the created thread
is stored in the
tHandle->thread_id argument. The new thread executes
the
wrapper_routine function.
void wrapper_routine(void *arg){
uarg_t *uarg = (uarg_t *)arg;
nice(rtos_to_nice(uarg->priority));
uarg->entry_routine(uarg->arg1, uarg->arg2,
uarg->arg3);
}
In wrapper_routine, the priority of the thread is adjusted using ...