Skip to contentSkip to conversation

RT_TASK structure

Xenomai-help Michel He 2 participants 4 messages May 11, 2010

lore
Share & tools
lore

Michel He

author
#0 lore raw

Hello all,

In Xenomai, I need an equivalent function of
pthread_setspecific in order to register a key element associated to the RT_TASK. Is it possible to you (maintainers of Xenomai core) to add an extra integer type (let's say int user_specific_data inside the struct rt_task) in the RT_TASK structure and then add functions similar to pthread_setspecific and pthread_getspecific to allow user to write and get this integer value (associated to RT_TASK) ?

Thank you very much

#1 lore raw
Quoted 9 lines · Michel He

Hello all,

In Xenomai, I need an equivalent function of
pthread_setspecific in order to register a key element associated to the RT_TASK. Is it possible to you (maintainers of Xenomai core) to add an extra integer type (let's say int user_specific_data inside the struct rt_task) in the RT_TASK structure and then add functions similar to pthread_setspecific and pthread_getspecific to allow user to write and get this integer value (associated to RT_TASK) ?

What is wrong with pthread_getspecific/pthread_setspecific? If you do not like them, you may use __thread storage local variables.

Signature · 1 line
                    Gilles.
author
#2 lore raw

Actually, I don't use the POSIX skin to implement functions.

So, I used to rt_task_self() to get an identifier, which inside an array having corresponding integer data for it. But this seems to be non trivial since the array size can be important. The search function can cost cpu time.

I though that we can use something like rt_task_get_specific()...

Gilles Chanteperdrix <[email protected]> a écrit :

Quoted 19 lines
Quoted 9 lines · Michel He

Hello all,

In Xenomai, I need an equivalent function of
pthread_setspecific in order to register a key element associated to the RT_TASK. Is it possible to you (maintainers of Xenomai core) to add an extra integer type (let's say int user_specific_data inside the struct rt_task) in the RT_TASK structure and then add functions similar to pthread_setspecific and pthread_getspecific to allow user to write and get this integer value (associated to RT_TASK) ?

What is wrong with pthread_getspecific/pthread_setspecific? If you do not like them, you may use __thread storage local variables.

--
Gilles.

#3 lore raw
Quoted 8 lines · Michel He

Actually, I don't use the POSIX skin to implement functions.

So, I used to rt_task_self() to get an identifier, which inside an array having corresponding integer data for it. But this seems to be non trivial since the array size can be important. The search function can cost cpu time.

I though that we can use something like rt_task_get_specific()...

pthread_getspecific/pthread_setspecific are not implemented by the POSIX skin, they are implemented by libpthread, and since all xenomai user-space skins use libpthread, your application is already linked with libpthread anyway. So, there is really no problem using them in an application using the native skin.

Signature · 1 line
                    Gilles.