summaryrefslogtreecommitdiff
path: root/apps/JAWS3/jaws3/Event_Dispatcher.cpp
blob: 6b498e23125170324066661082f1d49347897922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// $Id$

#include "ace/Log_Msg.h"
#include "ace/Thread.h"
#include "ace/Reactor.h"
#include "ace/Proactor.h"
#include "ace/POSIX_Proactor.h"

#ifndef JAWS_BUILD_DLL
#define JAWS_BUILD_DLL
#endif /*JAWS_BUILD_DLL*/

#include "jaws3/Event_Dispatcher.h"

static ACE_THR_FUNC_RETURN
JAWS_Event_Dispatcher_Proactor_Event_Loop (void *)
{
  ACE_Proactor::run_event_loop ();
  return 0;
}


void
JAWS_Event_Dispatcher::end_event_loop (void)
{
  ACE_Reactor::end_event_loop ();
}


void
JAWS_Event_Dispatcher::run_event_loop (void)
{
  // First, initiate the proactor thread

  int result;
  result = ACE_Thread::spawn ( JAWS_Event_Dispatcher_Proactor_Event_Loop
                             , 0
                             , THR_BOUND
                             );
  if (result < 0)
    {
      ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Thread::spawn"));
      return;
    }

  // Now, enter the reactor's event loop.
  ACE_Reactor::run_event_loop ();

  // End the proactor's event loop if reactor was interrupted.
  ACE_Proactor::end_event_loop ();
}