Index  Source Files  Annotated Class List  Alphabetical Class List  Class Hierarchy  Graphical Class Hierarchy 

FIX::Event Class Reference

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

#include <Event.h>

List of all members.

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 37 of file Event.h.


Constructor & Destructor Documentation

FIX::Event::Event (  )  [inline]

Definition at line 40 of file Event.h.

References m_event, and m_mutex.

00041   {
00042 #ifdef _MSC_VER
00043     m_event = CreateEvent( 0, false, false, 0 );
00044 #else
00045     pthread_mutex_init( &m_mutex, 0 );
00046     pthread_cond_init( &m_event, 0 );
00047 #endif
00048   }

FIX::Event::~Event (  )  [inline]

Definition at line 50 of file Event.h.

References m_event, and m_mutex.

00051   {
00052 #ifdef _MSC_VER
00053     CloseHandle( m_event );
00054 #else
00055     pthread_cond_destroy( &m_event );
00056     pthread_mutex_destroy( &m_mutex );
00057 #endif
00058   }


Member Function Documentation

void FIX::Event::signal (  )  [inline]

Definition at line 60 of file Event.h.

References m_event, and m_mutex.

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

00061   {
00062 #ifdef _MSC_VER
00063     SetEvent( m_event );
00064 #else
00065     pthread_mutex_lock( &m_mutex );
00066     pthread_cond_broadcast( &m_event );
00067     pthread_mutex_unlock( &m_mutex );
00068 #endif
00069   }

void FIX::Event::wait ( double  s  )  [inline]

Definition at line 71 of file Event.h.

References m_event, and m_mutex.

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

00072   {
00073 #ifdef _MSC_VER
00074     WaitForSingleObject( m_event, (long)(s * 1000) );
00075 #else
00076     pthread_mutex_lock( &m_mutex );
00077     timespec time, remainder;
00078     double intpart;
00079     time.tv_nsec = (long)(modf(s, &intpart) * 1e9);
00080     time.tv_sec = (int)intpart;
00081     pthread_cond_timedwait( &m_event, &m_mutex, &time );
00082     pthread_mutex_unlock( &m_mutex );
00083 #endif
00084   }


Member Data Documentation

pthread_cond_t FIX::Event::m_event [private]

Definition at line 90 of file Event.h.

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

pthread_mutex_t FIX::Event::m_mutex [private]

Definition at line 91 of file Event.h.

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


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

Generated on Mon Apr 5 20:59:58 2010 for QuickFIX by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2001