Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Re: libCom posix/Linux
From: Michael Davidsaver <mdavidsaver@gmail.com>
To: Heinz Junkes <junkes@fhi-berlin.mpg.de>
Cc: core-talk@aps.anl.gov
Date: Fri, 14 Jul 2017 14:56:07 +0200
Well this was a deliberate change.

https://github.com/epics-base/epics-base/commit/ca441a2a0e04e852ef202d2e68820da1fd67223d

The lack of the guard assertion (or once call) in this function is (I
think) based on the assumption that this check has already been
preformed by whichever function supplied the epicsThreadId being passed
to epicsThreadGetPosixPriority().

I think this is limited to:

epicsThreadCreate()
epicsThreadMustCreate()
epicsThreadGetIdSelf()
epicsThreadGetId()

of which epicsThreadGetId() asserts and the others call epicsThreadInit().

On 07/14/2017 08:45 AM, Heinz Junkes wrote:
> A “new” epicsShareFunc has been added in 3.16 ( maybe already in 3.15 ) to posix/osdThread.c
> 
> epicsShareFunc int epicsThreadGetPosixPriority(epicsThreadId pthreadInfo)
> {
> #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
>     double maxPriority,minPriority,slope,oss;
> 
>     if(pcommonAttr->maxPriority==pcommonAttr->minPriority)
>         return(pcommonAttr->maxPriority);
>     maxPriority = (double)pcommonAttr->maxPriority;
>     minPriority = (double)pcommonAttr->minPriority;
>     slope = (maxPriority - minPriority)/100.0;
>     oss = (double)pthreadInfo->osiPriority * slope + minPriority;
>     return((int)oss);
> #else
>     return 0;
> #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
> }
> 
> The function is declared here
> 
> src/libCom/osi/os/Linux/osdThread.h:epicsShareFunc int epicsThreadGetPosixPriority(epicsThreadId id);
> src/libCom/osi/os/posix/osdThread.h:epicsShareFunc int epicsThreadGetPosixPriority(epicsThreadId id);
> 
> 
> The function is not called elsewhere but in osdThread.c itself.
> Why not static to this file?
> 
> There is no “guard” in the function like in other similiar functions like
> 
> e.g.    assert(epicsThreadOnceCalled);
> 
> 
> Heinz
> 
> 
> 


References:
libCom posix/Linux Heinz Junkes

Navigate by Date:
Prev: libCom posix/Linux Heinz Junkes
Next: EPICS with RTEMS posix osdThread.c implementation Heinz P. Junkes
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: libCom posix/Linux Heinz Junkes
Next: EPICS with RTEMS posix osdThread.c implementation Heinz P. Junkes
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 17 Jul 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·