The shortest possible PVA monitor() example.
#if !defined(_WIN32)
#include <signal.h>
#define USE_SIGNAL
#endif
#include <epicsEvent.h>
#include <pva/client.h>
static volatile bool done;
#ifdef USE_SIGNAL
static
void handler(int num)
{
(void)num;
done = true;
if(mon)
}
#endif
int main(int argc, char *argv[])
{
try {
if(argc<=1) {
std::cerr<<
"Usage: "<<argv[0]<<
" <pvname>\n";
return 1;
}
#ifdef USE_SIGNAL
subscription = &mon;
signal(SIGINT, handler);
signal(SIGTERM, handler);
signal(SIGQUIT, handler);
#endif
int ret = 0;
while(!done) {
continue;
switch(mon.
event.event) {
ret = 1;
done = true;
break;
done = true;
break;
break;
}
done = true;
}
break;
}
}
#ifdef USE_SIGNAL
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
subscription = 0;
#endif
return ret;
return 1;
}
}