```cpp
#ifndef XEVENT_H
#define XEVENT_H
#include <mutex>
#include <condition_variable>
#include <chrono>
class XEvent
{
public:
XEvent();
~XEvent();
void wait();
bool wait(int iSec,int iMs);
void notifyOne();
void notifyAll();
private:
std::mutex m_mtx;
std::condition_variable m_cv;
};
#endif
#include "xevent.h"
XEvent::XEvent()
{
}
XEvent::~XEvent()
{
}
void XEvent::wait()
{
std::unique_lock<std::mutex> locker(m_mtx);
m_cv.wait(locker);
}
bool XEvent::wait(int iSec,int iMs)
{
std::unique_lock<std::mutex> locker(m_mtx);
std::chrono::seconds secs(iSec);
std::chrono::milliseconds ms(iMs);
auto ret = m_cv.wait_for(locker, secs+ms);
return (ret != std::cv_status::timeout);
}
void XEvent::notifyOne()
{
m_cv.notify_one();
}
void XEvent::notifyAll()
{
m_cv.notify_all();
}