EPICS Controls 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  2018  2019  <20202021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Graceful Shutdown with joinable thread
From: "Kim, Kukhee via Core-talk" <core-talk at aps.anl.gov>
To: EPICS core-talk <core-talk at aps.anl.gov>
Date: Wed, 1 Apr 2020 15:59:46 +0000
Hi Everyone,

I recently worked for some epics drivers to implement a graceful shutdown and got a question.
The drivers are SLAC specific but the question is general.

I saw there are some API changes to allow joinable thread.
Thus, I used it: "epicsThreadCreateOpt() with joinable option, and epicsThreadMustJoin()"

It looks mostly the same as the old way but is slightly better personally.

old way:
  • The  exit hook breaks  an infinite loop in driver thread
  • driver thread send an event when it returns
  • main thread (the exit hook) waits the event from the driver thread then exits

new with joinable thread:
  • The exit hook breaks an infinite loop in the driver thread
  • driver thread simply returns 
  • main thread (the exit hook) waits with epicsThreadMustJoin() then exits
There is a small downside: more steps to create thread - I have to set up a thread option structure before calling epicsThreadCreateOpt(),
Since, the un-joinable thread is default and it is for backward compatibility.

I am wondering about our evolutional direction:
Are we going to keep the un-joinable thread as a default? Or, migrate to the joinable thread?


Thank you for your advice.
I hope everyone keeps stay healthy and safe.

Best regards,
Kukhee

Kukhee Kim

TID AIR Advanced Control System

SLAC National Accelerator Laboratory

2575 Sand Hill Rd, MS 94

Menlo Park, CA 94025

Email: khkim at SLAC.Stanford.EDU

Phone: (650)926-4912

Fax:   (650)926-2923


Replies:
Re: Graceful Shutdown with joinable thread Johnson, Andrew N. via Core-talk

Navigate by Date:
Prev: Re: [Merge] ~bfrk/epics-base:remove-dbfl_type_rec into epics-base:7.0 Ben Franksen via Core-talk
Next: Build failed: EPICS Base base-7.0-572 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: [Merge] ~bfrk/epics-base:remove-dbfl_type_rec into epics-base:7.0 Ben Franksen via Core-talk
Next: Re: Graceful Shutdown with joinable thread Johnson, Andrew N. via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 13 Apr 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·