All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xenomai-help] pthread_[set|get]specific()
  2008-10-13 12:53 [Xenomai-help] pthread_[set|get]specific() Wolfgang Grandegger
@ 2008-10-13 12:52 ` Gilles Chanteperdrix
  2008-10-13 13:11   ` Wolfgang Grandegger
  2008-10-13 13:50   ` Philippe Gerum
  0 siblings, 2 replies; 5+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-13 12:52 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: xenomai-help

Wolfgang Grandegger wrote:
> 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?

-- 
                                                 Gilles.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Xenomai-help] pthread_[set|get]specific()
@ 2008-10-13 12:53 Wolfgang Grandegger
  2008-10-13 12:52 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2008-10-13 12:53 UTC (permalink / raw)
  To: xenomai-help

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xenomai-help] pthread_[set|get]specific()
  2008-10-13 12:52 ` Gilles Chanteperdrix
@ 2008-10-13 13:11   ` Wolfgang Grandegger
  2008-10-13 13:18     ` Gilles Chanteperdrix
  2008-10-13 13:50   ` Philippe Gerum
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2008-10-13 13:11 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

Gilles Chanteperdrix wrote:
> Wolfgang Grandegger wrote:
>> 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?

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.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xenomai-help] pthread_[set|get]specific()
  2008-10-13 13:11   ` Wolfgang Grandegger
@ 2008-10-13 13:18     ` Gilles Chanteperdrix
  0 siblings, 0 replies; 5+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-13 13:18 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: xenomai-help

Wolfgang Grandegger wrote:
> Gilles Chanteperdrix wrote:
>> Wolfgang Grandegger wrote:
>>> 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?
> 
> 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.

Yes it is supposed to be a pointer dereferencement, faster than a hash
or list lookup.

-- 
                                                 Gilles.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xenomai-help] pthread_[set|get]specific()
  2008-10-13 12:52 ` Gilles Chanteperdrix
  2008-10-13 13:11   ` Wolfgang Grandegger
@ 2008-10-13 13:50   ` Philippe Gerum
  1 sibling, 0 replies; 5+ messages in thread
From: Philippe Gerum @ 2008-10-13 13:50 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

Gilles Chanteperdrix wrote:
> Wolfgang Grandegger wrote:
>> 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?
> 

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...

-- 
Philippe.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-13 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-13 12:53 [Xenomai-help] pthread_[set|get]specific() Wolfgang Grandegger
2008-10-13 12:52 ` Gilles Chanteperdrix
2008-10-13 13:11   ` Wolfgang Grandegger
2008-10-13 13:18     ` Gilles Chanteperdrix
2008-10-13 13:50   ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.