Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

FIFO_Recv.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 // FIFO_Recv.cpp
00003 // $Id: FIFO_Recv.cpp,v 1.1.1.3.40.1 2003/03/13 19:44:21 chad Exp $
00004 
00005 #include "ace/FIFO_Recv.h"
00006 #include "ace/Log_Msg.h"
00007 
00008 #if defined (ACE_LACKS_INLINE_FUNCTIONS)
00009 #include "ace/FIFO_Recv.i"
00010 #endif
00011 
00012 ACE_RCSID(ace, FIFO_Recv, "$Id: FIFO_Recv.cpp,v 1.1.1.3.40.1 2003/03/13 19:44:21 chad Exp $")
00013 
00014 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv)
00015 
00016 void
00017 ACE_FIFO_Recv::dump (void) const
00018 {
00019   ACE_TRACE ("ACE_FIFO_Recv::dump");
00020   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00021   ACE_FIFO::dump ();
00022   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("aux_handle_ = %d"), this->aux_handle_));
00023   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00024 }
00025 
00026 int 
00027 ACE_FIFO_Recv::close (void)
00028 {
00029   ACE_TRACE ("ACE_FIFO_Recv::close");
00030   int result = ACE_FIFO::close ();
00031 
00032   if (this->aux_handle_ != ACE_INVALID_HANDLE)
00033     return ACE_OS::close (this->aux_handle_);
00034   else
00035     return result;
00036 }
00037 
00038 // Note that persistent means "open fifo for writing, as well as
00039 // reading."  This ensures that the fifo never gets EOF, even if there
00040 // aren't any writers at the moment!
00041 
00042 int
00043 ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name,
00044                      int flags,
00045                      int perms,
00046                      int persistent,
00047                      LPSECURITY_ATTRIBUTES sa)
00048 {
00049   ACE_TRACE ("ACE_FIFO_Recv::open");
00050 
00051   if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1)
00052     return -1;
00053   else if (this->disable (ACE_NONBLOCK) == -1)
00054     return -1;
00055   else if (persistent 
00056            && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE)
00057     return -1;
00058   else
00059     return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
00060 }
00061 
00062 ACE_FIFO_Recv::ACE_FIFO_Recv (void)
00063   : aux_handle_ (ACE_INVALID_HANDLE)
00064 {
00065   ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
00066 }
00067 
00068 ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name,
00069                               int flags,
00070                               int perms,
00071                               int persistent,
00072                               LPSECURITY_ATTRIBUTES sa)
00073   : aux_handle_ (ACE_INVALID_HANDLE)
00074 {
00075   ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
00076 
00077   if (this->ACE_FIFO_Recv::open (fifo_name,
00078                                  flags,
00079                                  perms,
00080                                  persistent,
00081                                  sa) == -1)
00082     ACE_ERROR ((LM_ERROR,  ACE_LIB_TEXT ("%p\n"),  ACE_LIB_TEXT ("ACE_FIFO_Recv")));
00083 }

Generated on Mon Jun 16 11:19:39 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002