summaryrefslogtreecommitdiff
path: root/ace/FIFO_Recv.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
commita5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch)
treebcf0a25c3d45a209a6e3ac37b233a4812f29c732 /ace/FIFO_Recv.cpp
downloadATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz
Initial revision
Diffstat (limited to 'ace/FIFO_Recv.cpp')
-rw-r--r--ace/FIFO_Recv.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/ace/FIFO_Recv.cpp b/ace/FIFO_Recv.cpp
new file mode 100644
index 00000000000..ff05686d6a1
--- /dev/null
+++ b/ace/FIFO_Recv.cpp
@@ -0,0 +1,63 @@
+// FIFO_Recv.cpp
+// $Id$
+
+/* -*- C++ -*- */
+
+#define ACE_BUILD_DLL
+#include "ace/FIFO_Recv.h"
+#include "ace/Log_Msg.h"
+
+ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv)
+
+void
+ACE_FIFO_Recv::dump (void) const
+{
+ ACE_TRACE ("ACE_FIFO_Recv::dump");
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_FIFO::dump ();
+ ACE_DEBUG ((LM_DEBUG, "aux_handle_ = %d", this->aux_handle_));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+}
+
+int
+ACE_FIFO_Recv::close (void)
+{
+ ACE_TRACE ("ACE_FIFO_Recv::close");
+ int result = ACE_FIFO::close ();
+ if (this->aux_handle_ != ACE_INVALID_HANDLE)
+ return ACE_OS::close (this->aux_handle_);
+ else
+ return result;
+}
+
+// Note that persistent means "open fifo for writing, as well as
+// reading." This ensures that the fifo never gets EOF, even if there
+// aren't any writers at the moment!
+
+int
+ACE_FIFO_Recv::open (const char *fifo_name, int flags, int perms, int persistent)
+{
+ ACE_TRACE ("ACE_FIFO_Recv::open");
+ if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms) == -1)
+ return -1;
+ else if (this->disable (ACE_NONBLOCK) == -1)
+ return -1;
+ else if (persistent && (this->aux_handle_ =
+ ACE_OS::open (fifo_name, O_WRONLY)) == ACE_INVALID_HANDLE)
+ return -1;
+ else
+ return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
+}
+
+ACE_FIFO_Recv::ACE_FIFO_Recv (void): aux_handle_ (ACE_INVALID_HANDLE)
+{
+ ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
+}
+
+ACE_FIFO_Recv::ACE_FIFO_Recv (const char *fifo_name, int flags, int perms, int persistent)
+{
+ ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
+ if (this->ACE_FIFO_Recv::open (fifo_name, flags, perms, persistent) == -1)
+ ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO_Recv"));
+}
+