Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / LOCK_SOCK_Acceptor.h
blob07d3a46210ab4d11ad78b06faffbcbeda25d4328
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file LOCK_SOCK_Acceptor.h
7 * @author James Hu and Irfan Pyarali
8 */
9 //=============================================================================
12 #ifndef ACE_LOCK_SOCK_ACCEPTOR_H
13 #define ACE_LOCK_SOCK_ACCEPTOR_H
14 #include /**/ "ace/pre.h"
16 #include "ace/SOCK_Acceptor.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
24 /**
25 * @class ACE_LOCK_SOCK_Acceptor
27 * @brief Specialize ACE_SOCK_Acceptor to lock around <accept>;
29 * This class is necessary since some OS platforms do not allow
30 * multiple threads/processes to simultaneously call @c accept
31 * on the same listen-mode port/socket. Thus, we need to
32 * protect against multiple concurrent accesses by using
33 * the appropriate type of lock.
35 template <class ACE_LOCK>
36 class ACE_LOCK_SOCK_Acceptor : public ACE_SOCK_Acceptor
38 public:
39 /// Accept the connection under the control of the <ACE_LOCK>.
40 int accept (ACE_SOCK_Stream &new_stream,
41 ACE_Addr *remote_addr = 0,
42 ACE_Time_Value *timeout = 0,
43 bool restart = true,
44 bool reset_new_handle = false) const;
46 /// Return a reference to the lock.
47 ACE_LOCK &lock ();
49 protected:
50 /// Type of locking mechanism.
51 ACE_LOCK lock_;
54 ACE_END_VERSIONED_NAMESPACE_DECL
56 #include "ace/LOCK_SOCK_Acceptor.cpp"
58 #include /**/ "ace/post.h"
59 #endif /* ACE_LOCK_SOCK_ACCEPTOR_H */