pthread_[set|get]specific()
Hello,
can pthread_[set|get]specifi()c be used safely in user space real-time tasks. Or does it result in a switch to secondary mode?
Wolfgang.
Quoted 4 lines · Wolfgang Grandegger
Hello,
can pthread_[set|get]specifi()c be used safely in user space real-time tasks. Or does it result in a switch to secondary mode?
I would expect pthread_getspecific to be safe on all platforms though (and actually, I think the fast mutexes implementation relies on that).
I would say it should be always safe or always non-safe. So, you may run a test with T_WARNSW (or XNTRAPSW) and you will know whether the implementation on your platform is safe.
pthread_setspecific is another story, maybe it can trigger a re-allocation?
Signature · 1 line
Gilles.
Quoted 6 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger
Hello,
can pthread_[set|get]specifi()c be used safely in user space real-time tasks. Or does it result in a switch to secondary mode?
Quoted 8 lines
I would expect
pthread_getspecificto be safe on all platforms though (and actually, I think the fast mutexes implementation relies on that).I would say it should be always safe or always non-safe. So, you may run a test with
T_WARNSW(or XNTRAPSW) and you will know whether the implementation on your platform is safe.
pthread_setspecificis another story, maybe it can trigger a re-allocation?
In fact, I only need pthread_getspecific in the real-time context. Hm, is it really fast? Maybe scanning my private phtread ids is faster.
Thanks.
Wolfgang.
Quoted 9 lines · Wolfgang Grandegger
Quoted 8 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger
Hello,
can pthread_[set|get]specifi()c be used safely in user space real-time tasks. Or does it result in a switch to secondary mode?
I would expect
pthread_getspecificto be safe on all platforms though (and actually, I think the fast mutexes implementation relies on that).
Quoted 8 lines
Quoted 5 lines
I would say it should be always safe or always non-safe. So, you may run a test with
T_WARNSW(or XNTRAPSW) and you will know whether the implementation on your platform is safe.
pthread_setspecificis another story, maybe it can trigger a re-allocation?In fact, I only need
pthread_getspecificin the real-time context. Hm, is it really fast? Maybe scanning my private phtread ids is faster.
Yes it is supposed to be a pointer dereferencement, faster than a hash or list lookup.
Signature · 1 line
Gilles.
Quoted 6 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger
Hello,
can pthread_[set|get]specifi()c be used safely in user space real-time tasks. Or does it result in a switch to secondary mode?
Quoted 9 lines
I would expect
pthread_getspecificto be safe on all platforms though (and actually, I think the fast mutexes implementation relies on that).I would say it should be always safe or always non-safe. So, you may run a test with
T_WARNSW(or XNTRAPSW) and you will know whether the implementation on your platform is safe.
pthread_setspecificis another story, maybe it can trigger a re-allocation?
It does call calloc() when two-level indexing is needed to register new keys. This said, this will only happen when more than 32 keys are created. Ok, it's fragile...
Signature · 1 line
Philippe.