00001
00002
00003 #include "ace/Event.h"
00004
00005 #if !defined (__ACE_INLINE__)
00006 #include "ace/Event.inl"
00007 #endif
00008
00009 #include "ace/Log_Msg.h"
00010
00011 ACE_RCSID(ace, Event, "Event.cpp,v 4.5 2005/10/28 16:14:52 ossama Exp")
00012
00013 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00014
00015 ACE_Event::ACE_Event (int manual_reset,
00016 int initial_state,
00017 int type,
00018 const ACE_TCHAR *name,
00019 void *arg)
00020 : removed_ (0)
00021 {
00022 if (ACE_OS::event_init (&this->handle_,
00023 manual_reset,
00024 initial_state,
00025 type,
00026 name,
00027 arg) != 0)
00028 ACE_ERROR ((LM_ERROR,
00029 ACE_LIB_TEXT ("%p\n"),
00030 ACE_LIB_TEXT ("ACE_Event::ACE_Event")));
00031 }
00032
00033 ACE_Event::~ACE_Event (void)
00034 {
00035 this->remove ();
00036 }
00037
00038 int
00039 ACE_Event::remove (void)
00040 {
00041 int result = 0;
00042 if (this->removed_ == 0)
00043 {
00044 this->removed_ = 1;
00045 result = ACE_OS::event_destroy (&this->handle_);
00046 }
00047 return result;
00048 }
00049
00050 int
00051 ACE_Event::wait (void)
00052 {
00053 return ACE_OS::event_wait (&this->handle_);
00054 }
00055
00056 int
00057 ACE_Event::wait (const ACE_Time_Value *abstime, int use_absolute_time)
00058 {
00059 return ACE_OS::event_timedwait (&this->handle_,
00060 const_cast <ACE_Time_Value *> (abstime),
00061 use_absolute_time);
00062 }
00063
00064 int
00065 ACE_Event::signal (void)
00066 {
00067 return ACE_OS::event_signal (&this->handle_);
00068 }
00069
00070 int
00071 ACE_Event::pulse (void)
00072 {
00073 return ACE_OS::event_pulse (&this->handle_);
00074 }
00075
00076 int
00077 ACE_Event::reset (void)
00078 {
00079 return ACE_OS::event_reset (&this->handle_);
00080 }
00081
00082 void
00083 ACE_Event::dump (void) const
00084 {
00085 #if defined (ACE_HAS_DUMP)
00086 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00087 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00088 #endif
00089 }
00090
00091 ACE_END_VERSIONED_NAMESPACE_DECL