---
name: "ACE_LOCK_SOCK_Acceptor"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_LOCK_SOCK_Acceptor"
---

# ACE\_LOCK\_SOCK\_Acceptor(3)

Specialize ACE\_SOCK\_Acceptor to lock around accept;

## NAME

ACE\_LOCK\_SOCK\_Acceptor -  Specialize ACE\_SOCK\_Acceptor to lock around accept;

## SYNOPSIS

```
#include <ace/LOCK_SOCK_Acceptor.h>
template<class ACE_LOCK>
class ACE_LOCK_SOCK_Acceptor : public ACE_SOCK_Acceptor
{
  public:
    int accept (
        ACE_SOCK_Stream &new_stream,
        ACE_Addr *remote_addr = 0,
        ACE_Time_Value *timeout = 0,
        int restart = 1,
        int reset_new_handle = 0
        ) const;
    ACE_LOCK &lock (void);
  protected:
    ACE_LOCK lock_;
};
```

## DESCRIPTION

This class is necessary since some OS platforms (e.g., Solaris 2.5) do not allow multiple threads/processes to simultaneously call accept on the same listen-mode port/socket.  Thus, we need to protect against multiple concurrent accesses by using the appropriate type of lock.

## PUBLIC MEMBERS

```
int accept (
    ACE_SOCK_Stream &new_stream,
    ACE_Addr *remote_addr = 0,
    ACE_Time_Value *timeout = 0,
    int restart = 1,
    int reset_new_handle = 0
    ) const;
```

Accept the connection under the control of the ACE\_LOCK.

```
ACE_LOCK &lock (void);
```

Return a reference to the lock.

## PROTECTED MEMBERS

```
ACE_LOCK lock_;
```

Type of locking mechanism.

## AUTHOR

James Hu and Irfan Pyarali

## LIBRARY

ace
