---
name: "ACE_Msg_WFMO_Reactor"
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_Msg_WFMO_Reactor"
---

# ACE\_Msg\_WFMO\_Reactor(3)

An OO event demultiplexor and event handler dispatcher for Win32 MsgWaitForMultipleObjects.

## NAME

ACE\_Msg\_WFMO\_Reactor -  An OO event demultiplexor and event handler dispatcher for Win32 MsgWaitForMultipleObjects.

## SYNOPSIS

```
#include <ace/Msg_WFMO_Reactor.h>
class ACE_Msg_WFMO_Reactor : public ACE_WFMO_Reactor
{
  public:
    ACE_Msg_WFMO_Reactor (
        ACE_Sig_Handler * = 0,
        ACE_Timer_Queue * = 0
        );
    ACE_Msg_WFMO_Reactor (
        size_t size,
        int unused = 0,
        ACE_Sig_Handler * = 0,
        ACE_Timer_Queue * = 0
        );
    virtual ~ACE_Msg_WFMO_Reactor (void);
    virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
    virtual int alertable_handle_events (
        ACE_Time_Value *max_wait_time = 0
        );
    virtual int handle_events (ACE_Time_Value &max_wait_time);
    virtual int alertable_handle_events (
        ACE_Time_Value &max_wait_time
        );
  protected:
    virtual int wait_for_multiple_events (int timeout, int alertable);
    virtual DWORD poll_remaining_handles (size_t index);
    virtual int dispatch_window_messages (void);
};
```

## DESCRIPTION

The ACE\_Msg\_WFMO\_Reactor is an OO event demultiplexor and event handler Reactor. It differs from ACE\_WFMO\_Reactor by its ability to react on Windows messages.  It is needed when the task should serve also as a COM/DCOM server.

## Initialization and termination methods.

```
ACE_Msg_WFMO_Reactor (ACE_Sig_Handler * = 0, ACE_Timer_Queue * = 0);
```

Initialize ACE\_Msg\_WFMO\_Reactor with the default size.

```
ACE_Msg_WFMO_Reactor (
    size_t size,
    int unused = 0,
    ACE_Sig_Handler * = 0,
    ACE_Timer_Queue * = 0
    );
```

Initialize ACE\_Msg\_WFMO\_Reactor with size size.  Two slots will be added to the size parameter which will store handles used for internal management purposes.

```
virtual ~ACE_Msg_WFMO_Reactor (void);
```

Close down the ACE\_Msg\_WFMO\_Reactor and release all of its resources.

```
virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
```

```
virtual int alertable_handle_events (
    ACE_Time_Value *max_wait_time = 0
    );
```

This event loop driver blocks for up to max\_wait\_time before returning.  It will return earlier if timer events, I/O events, window events, or signal events occur.  Note that max\_wait\_time can be 0, in which case this method blocks indefinitely until events occur.

max\_wait\_time is decremented to reflect how much time this call took.  For instance, if a time value of 3 seconds is passed to handle\_events and an event occurs after 2 seconds, max\_wait\_time will equal 1 second.  This can be used if an application wishes to handle events for some fixed amount of time.

MsgWaitForMultipleObjects is used as the demultiplexing call

Returns the total number of ACE\_Event\_Handlers that were dispatched, 0 if the max\_wait\_time elapsed without dispatching any handlers, or -1 if an error occurs.

The only difference between alertable\_handle\_events and handle\_events is that in the alertable case, MWMO\_ALERTABLE is passed to MsgWaitForMultipleObjects for the bAlertable option.

```
virtual int handle_events (ACE_Time_Value &max_wait_time);
```

```
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time);
```

This method is just like the one above, except the max\_wait\_time value is a reference and can therefore never be NULL.

## AUTHOR

Beskrovny Evgeny evgeny\_beskrovny@icomverse.com and Irfan Pyarali irfan@cs.wustl.edu

## LIBRARY

ace
