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, "$Id: Event.cpp 80826 2008-03-04 14:51:23Z wotte $")
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 LPSECURITY_ATTRIBUTES sa)
00021 : removed_ (false)
00022 {
00023 if (ACE_OS::event_init (&this->handle_,
00024 manual_reset,
00025 initial_state,
00026 type,
00027 name,
00028 arg,
00029 sa) != 0)
00030 ACE_ERROR ((LM_ERROR,
00031 ACE_TEXT ("%p\n"),
00032 ACE_TEXT ("ACE_Event::ACE_Event")));
00033 }
00034
00035 ACE_Event::~ACE_Event (void)
00036 {
00037 this->remove ();
00038 }
00039
00040 int
00041 ACE_Event::remove (void)
00042 {
00043 int result = 0;
00044 if (!this->removed_)
00045 {
00046 this->removed_ = true;
00047 result = ACE_OS::event_destroy (&this->handle_);
00048 }
00049 return result;
00050 }
00051
00052 int
00053 ACE_Event::wait (void)
00054 {
00055 return ACE_OS::event_wait (&this->handle_);
00056 }
00057
00058 int
00059 ACE_Event::wait (const ACE_Time_Value *abstime, int use_absolute_time)
00060 {
00061 return ACE_OS::event_timedwait (&this->handle_,
00062 const_cast <ACE_Time_Value *> (abstime),
00063 use_absolute_time);
00064 }
00065
00066 int
00067 ACE_Event::signal (void)
00068 {
00069 return ACE_OS::event_signal (&this->handle_);
00070 }
00071
00072 int
00073 ACE_Event::pulse (void)
00074 {
00075 return ACE_OS::event_pulse (&this->handle_);
00076 }
00077
00078 int
00079 ACE_Event::reset (void)
00080 {
00081 return ACE_OS::event_reset (&this->handle_);
00082 }
00083
00084 void
00085 ACE_Event::dump (void) const
00086 {
00087 #if defined (ACE_HAS_DUMP)
00088 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00089 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00090 #endif
00091 }
00092
00093 ACE_END_VERSIONED_NAMESPACE_DECL