LOCK_SOCK_Acceptor.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    LOCK_SOCK_Acceptor.h
00006  *
00007  *  LOCK_SOCK_Acceptor.h,v 4.16 2005/10/28 16:14:52 ossama Exp
00008  *
00009  *  @author James Hu and Irfan Pyarali
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_LOCK_SOCK_ACCEPTOR_H
00015 #define ACE_LOCK_SOCK_ACCEPTOR_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/SOCK_Acceptor.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class ACE_LOCK_SOCK_Acceptor
00028  *
00029  * @brief Specialize <ACE_SOCK_Acceptor> to lock around <accept>;
00030  *
00031  * This class is necessary since some OS platforms (e.g.,
00032  * Solaris 2.5) do not allow multiple threads/processes to
00033  * simultaneously call <accept> on the same listen-mode
00034  * port/socket.  Thus, we need to protect against multiple
00035  * concurrent accesses by using the appropriate type of lock.
00036  */
00037 template <class ACE_LOCK>
00038 class ACE_LOCK_SOCK_Acceptor : public ACE_SOCK_Acceptor
00039 {
00040 public:
00041   /// Accept the connection under the control of the <ACE_LOCK>.
00042   int accept (ACE_SOCK_Stream &new_stream,
00043               ACE_Addr *remote_addr = 0,
00044               ACE_Time_Value *timeout = 0,
00045               int restart = 1,
00046               int reset_new_handle = 0) const;
00047 
00048   /// Return a reference to the lock.
00049   ACE_LOCK &lock (void);
00050 
00051 protected:
00052   /// Type of locking mechanism.
00053   ACE_LOCK lock_;
00054 };
00055 
00056 ACE_END_VERSIONED_NAMESPACE_DECL
00057 
00058 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00059 #include "ace/LOCK_SOCK_Acceptor.cpp"
00060 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00061 
00062 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00063 #pragma implementation ("LOCK_SOCK_Acceptor.cpp")
00064 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00065 
00066 #include /**/ "ace/post.h"
00067 #endif /* ACE_LOCK_SOCK_ACCEPTOR_H */

Generated on Thu Nov 9 09:41:53 2006 for ACE by doxygen 1.3.6