EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Problems with priorities in epicsThreadCreate (part of the EPICS OSI software layer)
From: Goetz Pfeiffer <[email protected]>
To: <[email protected]>
Cc: Eric Norum <[email protected]>
Date: Wed, 22 Feb 2012 11:06:11 +0100
Hi Andrew,
hi Eric,

thank you for your reply.

Adding operating system dependent code to my application to set the
priority would be a solution of course.

However, the intention of EPICS OSI is that I don't have to do that. If
there was a possibility to
specify the thread priority directly, I wouldn't have to include system
headers or call system functions
directly. If EPICS OSI was changed or extended, my code would look like
this:

#if defined(vxWorks)
  #define GPS_WRITER_PRIO 67
#elif defined(RTEMS)
  #define GPS_WRITER_PRIO 123
#endif

epicsThreadCreate("mC Writer", GPS_WRITER_PRIO,
                  epicsThreadGetStackSize(epicsThreadStackSmall),
                  (EPICSTHREADFUNC) gps_writer, NULL))

Isn't this nicer than having to call taskPrioritySet or
rtems_task_set_priority directly as
in your quoted mail below ?

The way epicsThreadCreate in EPICS OSI handles priorities at least in
the vxWorks and RTEMS
implementation seems to be a design flaw for me. Why not fix it ?

Greetings,

  Goetz

On 02/20/2012 10:46 PM, Andrew Johnson wrote:
Hi Goetz,

On 2012-02-20 Eric Norum wrote:
How about calling the RTEMS rtems_task_set_priority routine from the
beginning of your new thread?
I think I prefer Eric's suggestion to adding anything to the epicsThread API.

For each particular OS you will already need an OS-specific numeric priority,
so you'll have to have OS-specific code in the source file anyway.  In that
case you can just call the OS-specific API to change the new thread's
priority.  For vxWorks and RTEMS that would mean adding something like this:

#if defined(vxWorks)
     taskPrioritySet(0, 66);
#elif defined(RTEMS)
     {
         rtems_task_priority old;
         rtems_task_set_priority(RTEMS_SELF, 66,&old);
     }
#endif

Now it's obvious that the this is OS-specific code, and the thread priority
can be easily set to whatever is appropriate for the OS.

- Andrew


________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführerin: Prof. Dr. Anke Rita Kaysser-Pyzalla

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de


Replies:
Best pratices for compiling dbd files for asyn base device support Abadie Lana
Re: Problems with priorities in epicsThreadCreate (part of the EPICS OSI software layer) Andrew Johnson
References:
Problems with priorities in epicsThreadCreate (part of the EPICS OSI software layer) Goetz Pfeiffer
Re: Problems with priorities in epicsThreadCreate (part of the EPICS OSI software layer) Eric Norum
Re: Problems with priorities in epicsThreadCreate (part of the EPICS OSI software layer) Andrew Johnson

Navigate by Date:
Prev: RE: Connection to Siemens S7 PLC Mueller, Joachim
Next: Best pratices for compiling dbd files for asyn base device support Abadie Lana
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Problems with priorities in epicsThreadCreate (part of the EPICS OSI software layer) Andrew Johnson
Next: Best pratices for compiling dbd files for asyn base device support Abadie Lana
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·