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

LOCK_SOCK_Acceptor.h

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

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