The errlog facility provides errlogAddListener, and errlogRemoveListener.
Unfortunately, the latter is broken, as there is no way to specify the
listener's private data. So if I have two listeners which differ only in their
private data (such as when using two instances of feller), then I can only
remove them all at once, not each one separately.
The attached patch file rectifies that by adding an errlogRemoveSingleListener
function to the API that allows to remove single instances.
Cheers
--
Ben Franksen
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachm€nts
Fri Jun 21 11:15:25 CEST 2013 [email protected]
* FIX: libCom/error: added errlogRemoveSingleListener
diff -rN -u old-3-14-12-2-1/src/libCom/error/errlog.c new-3-14-12-2-1/src/libCom/error/errlog.c
--- old-3-14-12-2-1/src/libCom/error/errlog.c 2013-06-21 11:17:28.886150560 +0200
+++ new-3-14-12-2-1/src/libCom/error/errlog.c 2013-06-21 11:17:30.449710101 +0200
@@ -324,6 +324,28 @@
}
}
+epicsShareFunc void epicsShareAPI errlogRemoveSingleListener(
+ errlogListener listener, void *pPrivate)
+{
+ listenerNode *plistenerNode;
+
+ errlogInit(0);
+ if (!pvtData.atExit) epicsMutexMustLock(pvtData.listenerLock);
+ plistenerNode = (listenerNode *)ellFirst(&pvtData.listenerList);
+ while (plistenerNode) {
+ if (plistenerNode->listener==listener && plistenerNode->pPrivate==pPrivate) {
+ ellDelete(&pvtData.listenerList, &plistenerNode->node);
+ free((void *)plistenerNode);
+ break;
+ }
+ plistenerNode = (listenerNode *)ellNext(&plistenerNode->node);
+ }
+ if (!pvtData.atExit) epicsMutexUnlock(pvtData.listenerLock);
+ if (!plistenerNode) {
+ fprintf(stderr, "errlogRemoveListener did not find listener\n");
+ }
+}
+
epicsShareFunc int epicsShareAPI eltc(int yesno)
{
errlogInit(0);
diff -rN -u old-3-14-12-2-1/src/libCom/error/errlog.h new-3-14-12-2-1/src/libCom/error/errlog.h
--- old-3-14-12-2-1/src/libCom/error/errlog.h 2013-06-21 11:17:28.882151686 +0200
+++ new-3-14-12-2-1/src/libCom/error/errlog.h 2013-06-21 11:17:30.449710101 +0200
@@ -58,6 +58,8 @@
errlogListener listener, void *pPrivate);
epicsShareFunc void epicsShareAPI errlogRemoveListener(
errlogListener listener);
+epicsShareFunc void epicsShareAPI errlogRemoveSingleListener(
+ errlogListener listener, void *pPrivate);
epicsShareFunc int epicsShareAPI eltc(int yesno);
epicsShareFunc int epicsShareAPI errlogInit(int bufsize);
Attachment:
signature.asc
Description: This is a digitally signed message part.
- Replies:
- Re: Problem in errlogRemoveListener Benjamin Franksen
- Navigate by Date:
- Prev:
Re: help setting up XY table control with EPICS StreamerClass Christian Pauly
- Next:
Re: Problem in errlogRemoveListener Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
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:
Scientific programmer II position available at the Joint Astronomy Centre Maren Purves
- Next:
Re: Problem in errlogRemoveListener Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|