FIX::Event Class Reference

Portable implementation of an event/conditional mutex. More...

`#include <Event.h>`

## Public Member Functions

| Event ()
| ~Event ()
void | signal ()
void | wait (double s)

## Private Attributes

pthread_cond_t | m_event
pthread_mutex_t | m_mutex

## Detailed Description

Portable implementation of an event/conditional mutex.

Definition at line 36 of file Event.h.

## Constructor & Destructor Documentation

## Event()

FIX::Event::Event | ( |  | ) |

inline

Definition at line 39 of file Event.h.

{
#ifdef _MSC_VER
m_event = CreateEvent( 0, false, false, 0 );
#else
pthread_mutex_init( &m_mutex, 0 );
pthread_cond_init( &m_event, 0 );
#endif
}
FIX::Event::m_event
pthread_cond_t m_event
Definition Event.h:89
FIX::Event::m_mutex
pthread_mutex_t m_mutex
Definition Event.h:90

References m_event, and m_mutex.

## ~Event()

FIX::Event::~Event | ( |  | ) |

inline

Definition at line 49 of file Event.h.

{
#ifdef _MSC_VER
CloseHandle( m_event );
#else
pthread_cond_destroy( &m_event );
pthread_mutex_destroy( &m_mutex );
#endif
}

References m_event, and m_mutex.

## Member Function Documentation

## signal()

void FIX::Event::signal | ( |  | ) |

inline

Definition at line 59 of file Event.h.

{
#ifdef _MSC_VER
SetEvent( m_event );
#else
pthread_mutex_lock( &m_mutex );
pthread_cond_broadcast( &m_event );
pthread_mutex_unlock( &m_mutex );
#endif
}

References m_event, and m_mutex.

Referenced by FIX::Queue< T >::signal().

## wait()

void FIX::Event::wait | ( | double | s | ) |

inline

Definition at line 70 of file Event.h.

{
#ifdef _MSC_VER
WaitForSingleObject( m_event, (long)(s * 1000) );
#else
pthread_mutex_lock( &m_mutex );
timespec time, remainder;
double intpart;
time.tv_nsec = (long)(modf(s, &intpart) * 1e9);
time.tv_sec = (int)intpart;
pthread_cond_timedwait( &m_event, &m_mutex, &time );
pthread_mutex_unlock( &m_mutex );
#endif
}

References m_event, and m_mutex.

Referenced by FIX::Queue< T >::wait().

## Member Data Documentation

## m_event

pthread_cond_t FIX::Event::m_event

private

Definition at line 89 of file Event.h.

Referenced by Event(), signal(), wait(), and ~Event().

## m_mutex

pthread_mutex_t FIX::Event::m_mutex

private

Definition at line 90 of file Event.h.

Referenced by Event(), signal(), wait(), and ~Event().

The documentation for this class was generated from the following file:

- Event.h