RT_TASK structure
Hello all,
In Xenomai, I need an equivalent function ofpthread_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
Quoted 9 lines · Michel He
Hello all,
In Xenomai, I need an equivalent function of
pthread_setspecificin order to register a key element associated to theRT_TASK. Is it possible to you (maintainers of Xenomai core) to add an extra integer type (let's say intuser_specific_datainside the structrt_task) in theRT_TASKstructure and then add functions similar topthread_setspecificandpthread_getspecificto allow user to write and get this integer value (associated toRT_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.
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_setspecificin order to register a key element associated to theRT_TASK. Is it possible to you (maintainers of Xenomai core) to add an extra integer type (let's say intuser_specific_datainside the structrt_task) in theRT_TASKstructure and then add functions similar topthread_setspecificandpthread_getspecificto allow user to write and get this integer value (associated toRT_TASK) ?What is wrong with pthread_getspecific/pthread_setspecific? If you do not like them, you may use
__threadstorage local variables.--
Gilles.
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.