Experimental Physics and Industrial Control System
After upgrading to Epics/Base 3.14.6 from 3.13.10 I am having difficulty
handling signals. In one of our applications if the user does a
control-C it is suppose to trap the signal and restore the PVs to their
original values. Odds are the control-c will occur while in a
ca_pend_event call. When I go to do a ca_pend_io in the interrupt
handler I get the error:
pthread_mutex_unlock failed: error Not owner
fatal error: epicsMutexOsdUnlock
I have included a simple program that displays the same problem. If
anyone knows the proper way of doing CA calls after catching a signal
please let me know.
Thanks,
--Bob Soliday
#include <stdio.h>
#include <strings.h>
#include <cadef.h>
#include <signal.h>
void interrupt_handler(int);
chid channelID[1];
char names[1][40];
int main(int argc, char **argv)
{
strcpy(names[0], "oag:H1:setCurrentC");
ca_task_initialize();
if (ca_search(names[0], &channelID[0])!=ECA_NORMAL) {
fprintf(stderr, "error: search failed for PV\n");
return(1);
}
if (ca_pend_io(10)!=ECA_NORMAL) {
fprintf(stderr, "error: search failed for PV\n");
return(1);
}
fprintf(stdout, "Found PV\n");
signal(SIGINT, interrupt_handler);
ca_pend_event(10);
ca_task_exit();
fprintf(stdout, "Done\n");
return(0);
}
void interrupt_handler(int sig) {
double value;
fprintf(stdout, "Interrupt detected\n");
if (ca_get(DBR_DOUBLE, channelID[0], &value)!=ECA_NORMAL) {
fprintf(stderr, "Error: unable to get value for PV\n");
}
if (ca_pend_io(10)!=ECA_NORMAL) {
fprintf(stderr, "Error: unable to get value for PV\n");
}
fprintf(stdout, "value = %lf\n", value);
}
- Replies:
- Re: Proglem doing CA calls after catching a signal Eric Norum
- Navigate by Date:
- Prev:
RE: GreenSpring TIP810 CANbus system Allison, Stephanie
- Next:
Re: Proglem doing CA calls after catching a signal Eric Norum
- 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:
Re: CA Gateway Kenneth Evans, Jr.
- Next:
Re: Proglem doing CA calls after catching a signal Eric Norum
- 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