/* event.cpp */ /* * Copyright information and license terms for this software can be * found in the file LICENSE that is included with the distribution */ /** * @author mrk */ #include #include #include #include #include #include #include #include #include #include #include #define epicsExportSharedSymbols #include #include #include #include using std::string; namespace epics { namespace pvData { Event::~Event() { epicsEventDestroy(id); id = 0; } Event::Event(bool full) : id(epicsEventCreate(full?epicsEventFull : epicsEventEmpty)) { } void Event::signal() { if(id==0) throw std::logic_error(string("event was deleted")); epicsEventSignal(id); } bool Event::wait () { if(id==0) throw std::logic_error(string("event was deleted")); epicsEventWaitStatus status = epicsEventWait(id); return status==epicsEventWaitOK ? true : false; } bool Event::wait ( double timeOut ) { if(id==0) throw std::logic_error(string("event was deleted")); epicsEventWaitStatus status = epicsEventWaitWithTimeout(id,timeOut); return status==epicsEventWaitOK ? true : false; } bool Event::tryWait () { if(id==0) throw std::logic_error(string("event was deleted")); epicsEventWaitStatus status = epicsEventTryWait(id); return status==epicsEventWaitOK ? true : false; } }}