Experimental Physics and Industrial Control System
Subject: |
Re: [Merge] ~epics-core/epics-base/+git/Com:thread-join into epics-base:7.0 |
From: |
Andrew Johnson via Core-talk <[email protected]> |
To: |
mdavidsaver <[email protected]> |
Date: |
Mon, 17 Jun 2019 19:24:36 -0000 |
I noticed the other day that VxWorks 6.9 added this API:
STATUS taskWait(TASK_ID taskId, _Vx_ticks_t timeout);
This behaves like pthread_join(), but without copying the thread's exit status to the caller.
Should the epicsThreadJoin() API take a timeout argument? That seems like a useful thing which could be hard or impossible to implement in portable application code, although I haven't looked too closely at how easy it would be to implement for the other OSs (RTEMS looks easy though). Adding this would also require adding a return status so the application knows what happened. If the routine returned a status value we could avoid the need to call cantProceed(). We could provide an epicsThreadMustJoin() API which does the cantProceed() thing...
Shouldn't the C++ class also have a join() method? The destructor acts as one so maybe it isn't essential, but there's no way to provide it with timeout value or get errors back.
I see that the epicsThread class always sets opts.joinable=1 even when the underlying OS defines EPICS_THREAD_CAN_JOIN (0) and only provides an empty epicsThreadJoin() routine. Is that what you implemented in the "epicsThread fix join" commit 149ab118?
Looking at the Posix implementation, a joinable thread that calls epicsThreadJoin(epicsThreadGetIdSelf()) should become unjoinable, but the code doesn't reset the id->joinable flag despite calling pthread_detach(). I didn't check the others for similar issues.
Do you have any test code for this? I just created an implementation for VxWorks 6.9 and later but it may be too simple, so adding some tests to epicsThreadTest.cpp would be helpful.
Will eventually need documentation and a Release Notes entry.
--
https://code.launchpad.net/~epics-core/epics-base/+git/Com/+merge/361379
Your team EPICS Core Developers is subscribed to branch epics-base:7.0.
- Navigate by Date:
- Prev:
[Bug 1833108] Re: CA context not set during disconnect callback mdavidsaver via Core-talk
- Next:
Re: [Merge] ~epics-core/epics-base/+git/Com:thread-join into epics-base:7.0 mdavidsaver via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
[Bug 1833108] Re: CA context not set during disconnect callback mdavidsaver via Core-talk
- Next:
Re: [Merge] ~epics-core/epics-base/+git/Com:thread-join into epics-base:7.0 mdavidsaver via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024