1 #include "ace/FIFO_Recv.h"
2 #include "ace/Log_Category.h"
3 #include "ace/OS_NS_fcntl.h"
4 #if defined (ACE_HAS_ALLOC_HOOKS)
5 # include "ace/Malloc_Base.h"
6 #endif /* ACE_HAS_ALLOC_HOOKS */
8 #if !defined (__ACE_INLINE__)
9 #include "ace/FIFO_Recv.inl"
10 #endif /* __ACE_INLINE__ */
12 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
14 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv
)
17 ACE_FIFO_Recv::dump () const
19 #if defined (ACE_HAS_DUMP)
20 ACE_TRACE ("ACE_FIFO_Recv::dump");
21 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
23 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("aux_handle_ = %d"), this->aux_handle_
));
24 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
25 #endif /* ACE_HAS_DUMP */
29 ACE_FIFO_Recv::close ()
31 ACE_TRACE ("ACE_FIFO_Recv::close");
32 int result
= ACE_FIFO::close ();
34 if (this->aux_handle_
!= ACE_INVALID_HANDLE
)
35 return ACE_OS::close (this->aux_handle_
);
40 // Note that persistent means "open fifo for writing, as well as
41 // reading." This ensures that the fifo never gets EOF, even if there
42 // aren't any writers at the moment!
45 ACE_FIFO_Recv::open (const ACE_TCHAR
*fifo_name
,
49 LPSECURITY_ATTRIBUTES sa
)
51 ACE_TRACE ("ACE_FIFO_Recv::open");
53 if (ACE_FIFO::open (fifo_name
, ACE_NONBLOCK
| flags
, perms
, sa
) == -1)
55 else if (this->disable (ACE_NONBLOCK
) == -1)
58 && (this->aux_handle_
= ACE_OS::open (fifo_name
, O_WRONLY
, 0, sa
)) == ACE_INVALID_HANDLE
)
61 return this->get_handle () == ACE_INVALID_HANDLE
? -1 : 0;
64 ACE_FIFO_Recv::ACE_FIFO_Recv ()
65 : aux_handle_ (ACE_INVALID_HANDLE
)
67 ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
70 ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR
*fifo_name
,
74 LPSECURITY_ATTRIBUTES sa
)
75 : aux_handle_ (ACE_INVALID_HANDLE
)
77 ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
79 if (this->ACE_FIFO_Recv::open (fifo_name
,
84 ACELIB_ERROR ((LM_ERROR
, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv")));
87 ACE_END_VERSIONED_NAMESPACE_DECL