Robert Soliday wrote:
> int sigint=0;
.
.
.
/* wrapper for ca_pend_event that allows breaking out early if the
flag is set from a signal handler. Unlike ca_pend_event, a timeout
of zero will not be converted to infinity. */
long oag_ca_pend_event(double timeout, int *flag) {
long status=ECA_NORMAL;
if (timeout <= 0)
ca_poll();
while (timeout > 0) {
if (*flag)
return(status);
if (timeout > 1) {
status = ca_pend_event(1);
timeout -= 1;
} else {
status = ca_pend_event(timeout);
timeout = 0;
}
}
return(status);
}
I'm not completely up to speed on the latest 'alias/noalias' state of C
pointers, but I think that it would be safer to add some 'volatile' keywords
to protect yourself from overzealous optimizers:
volatile int sigint = 0;
.
.
long oag_ca_pend_event(double timeout, volatile int *flag) {
.
.
--
Eric Norum [email protected]
Advanced Photon Source Phone: (630) 252-4793
Argonne National Laboratory
- Replies:
- RE: Program calling CA from witrin a posix signal handler Jeff Hill
- References:
- Proglem doing CA calls after catching a signal Robert Soliday
- Re: Proglem doing CA calls after catching a signal Eric Norum
- Re: Proglem doing CA calls after catching a signal Till Straumann
- Re: Proglem doing CA calls after catching a signal Chris Larrieu
- Re: Proglem doing CA calls after catching a signal Robert Soliday
- Navigate by Date:
- Prev:
Re: Proglem doing CA calls after catching a signal Robert Soliday
- Next:
Base on windows Steven Hunt
- 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: Proglem doing CA calls after catching a signal Robert Soliday
- Next:
RE: Program calling CA from witrin a posix signal handler Jeff Hill
- 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
|