---
name: "ACE_Process_Strategy"
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_Process_Strategy"
---

# ACE\_Process\_Strategy(3)

Defines the interface for specifying a concurrency strategy for a SVC\_HANDLER based on multiprocessing.

## NAME

ACE\_Process\_Strategy -  Defines the interface for specifying a concurrency strategy for a SVC\_HANDLER based on multiprocessing.

## SYNOPSIS

```
#include <ace/ACE_Strategies_T.h>
template<class SVC_HANDLER>
class ACE_Process_Strategy :
  public ACE_Concurrency_Strategy<SVC_HANDLER>
{
  public:
    ACE_Process_Strategy (
        size_t n_processes = 1,
        ACE_Event_Handler *acceptor = 0,
        ACE_Reactor * = 0,
        int avoid_zombies = 0
        );
    virtual int open (
        size_t n_processes = 1,
        ACE_Event_Handler *acceptor = 0,
        ACE_Reactor * = 0,
        int avoid_zombies = 0
        );
    virtual ~ACE_Process_Strategy (void);
    virtual int activate_svc_handler (
        SVC_HANDLER *svc_handler,
        void *arg = 0
        );
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  protected:
    typedef ACE_Concurrency_Strategy<SVC_HANDLER> inherited;
    size_t n_processes_;
    ACE_Event_Handler *acceptor_;
    ACE_Reactor *reactor_;
};
```

## DESCRIPTION

This class provides a strategy that manages the creation of processes to handle requests from clients concurrently.  It behaves as a "process factory", using ACE::fork to fork threads "on-demand" to run the service specified by a user-supplied SVC\_HANDLER in a separate process.

## Intialization and termination methods.

```
ACE_Process_Strategy (
    size_t n_processes = 1,
    ACE_Event_Handler *acceptor = 0,
    ACE_Reactor * = 0,
    int avoid_zombies = 0
    );
```

Initialize the strategy.  If avoid\_zombies is non-0 then set a flag to ACE::fork to avoid zombies.

```
virtual int open (
    size_t n_processes = 1,
    ACE_Event_Handler *acceptor = 0,
    ACE_Reactor * = 0,
    int avoid_zombies = 0
    );
```

Initialize the strategy.  If avoid\_zombies is non-0 then set a flag to ACE::fork to avoid zombies.

```
virtual ~ACE_Process_Strategy (void);
```

## Factory method.

```
virtual int activate_svc_handler (
    SVC_HANDLER *svc_handler,
    void *arg = 0
    );
```

Activate the svc\_handler with an appropriate concurrency strategy.  This method activates the SVC\_HANDLER by first forking and then calling the open method of the SVC\_HANDLER in the child.

```
void dump (void) const;
```

Dump the state of an object.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## LIBRARY

ace
