pthread_barrier_wait() in RTEMS?

Joel Sherrill joel.sherrill at OARcorp.com
Tue Nov 16 23:28:37 UTC 2010


On 11/16/2010 05:23 PM, Oyake, Amalaye (3424) wrote:
> Hello,
>
> does RTEMS provide the pthread_barrier_wait() function? I am just asking ...
> I am doing some VxWorks stuff, and I am looking for this function, but I
> don¹t even think it is there ... I am writing some code that needs a barrier
> pattern ... Hence I may have roll my own ...
>
This was added before 4.8 according to CVS. :-D

It is also in the Classic API with a couple of additional features:

+ manual release
+ timeout on wait.
> At some future point I will likely need to revisit this in RTEMS ... And
> that code will be needed there too ...
>
> That said I am a bit perplexed by the Linux man page warning on this
> function ~ ³Applications  using this function may be subject to priority
> inversion as discussed in the Base Definitions  volume  of  IEEE Std
> 1003.1-2001, Section 3.285, Priority Inversion.² ... So I may need to
> understand the nuances of this POSIX implementation ...
I have no idea off hand what that means.  Tasks block and are
released as a set.  Then priority scheduling takes over.  Technically
I suppose on some implementations, an unblocked task may get
to run before the others are released but that seems unlikely.

In RTEMS, they are released as a SET during a dispatching critical
section.  Then there is a dispatch enable and priority scheduling
makes sure the highest priority one runs.

I suppose the comment in the standard is just to make you aware
of what might be going on and how it might have an impact.
> I guess this makes me wonder which of the new fangled pthread_ functions are
> supported (pthread_spin_lock etc etc) ...
>
I am not a fan of pthread_spin_xxx but maybe someone can enlighten
me where they would be useful in a single processor system.

RTEMS also added pthread rwlock around the same time. :-D

--joel
> Regards,
> * Amalaye Oyake                                    *
> * Flight Software Applications&  Data Product Mgmt */\
> * 818.393.7168 work   626.399.1707 cell            *||
> * Jet Propulsion Laboratory, Pasadena  CA 91109   */||\


-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985





More information about the users mailing list