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  2012  <20132014  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  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: threading in asyn device support
From: Andrew Johnson <[email protected]>
To: EPICS Tech-Talk <[email protected]>
Date: Thu, 19 Sep 2013 10:57:07 -0500
On 09/19/2013 10:38 AM, Ralph Lange wrote:
On 19.09.2013 17:32, Vikram Bhagat wrote:
    Thanks for explanation.  One more question.
after completion of task how to delete Thread in EPICS (epicsThread),
or it is not required in EPICS?

 From the Application Developer's Guide, chapter 20.14 epicsThread:

    Life cycle - A thread starts life as a result of a call to
    epicsThreadCreate. It terminates when the thread function
    returns. It should not return until it has released all resources it
    uses. If a thread is expected to terminate as a
    natural part of its life cycle then the thread function must return.

One additional point; there is a C++ API (documented just below the C API in the AppDevGuide) which is slightly different to the C API that Ralph mentions above. If you choose to use the C++ API you create a class epicsThread object for the thread which must be deleted after you've finished with it.

Note that there is a simpler and alternative to creating your own thread which uses less memory; assuming that this is code that runs inside an IOC you might want to look at the Callback API which is documented in section 16.2 of the Application Developers Guide. It provides a general-purpose task for executing jobs in a common thread, and you can just queue your task to be executed immediately or after some delay.

- Andrew
--
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock

References:
threading in asyn device support Vikram Bhagat
Re: threading in asyn device support Ralph Lange
Re: threading in asyn device support Vikram Bhagat
Re: threading in asyn device support Ralph Lange

Navigate by Date:
Prev: Bug in seq-2.1.13 Benjamin Franksen
Next: Re: Bug in seq-2.1.13 Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: threading in asyn device support Ralph Lange
Next: Bug in seq-2.1.13 Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·