Commit b8c1ed12 authored by yoogx's avatar yoogx

* __po_hi_task_id __po_hi_get_task_id (void): new function

          that returns the id of the current task
parent fe0fefe2
Pipeline #351 skipped
......@@ -112,6 +112,11 @@ typedef size_t __po_hi_stack_t;
*/
int __po_hi_initialize_tasking(void);
/*
* Get the id of a task
*/
__po_hi_task_id __po_hi_get_task_id (void);
/*
* Create a periodic task.
*
......
......@@ -109,6 +109,21 @@ __po_hi_task_t tasks[__PO_HI_NB_TASKS];
HANDLE __po_hi_tasks_array[__PO_HI_NB_TASKS];
#endif
__po_hi_task_id __po_hi_get_task_id (void) {
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
pthread_t pthread_id = pthread_self();
for (int i = 0; i < __PO_HI_NB_TASKS; i++) {
if (pthread_id == tasks[i].tid) {
return tasks[i].id;
}
}
#endif
return (__PO_HI_ERROR_UNKNOWN);
}
void __po_hi_wait_for_tasks ()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment