OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librlink/] [RlinkServerEventLoop.cpp] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 wfjm
// $Id: RlinkServerEventLoop.cpp 495 2013-03-06 17:13:48Z mueller $
2
//
3
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2013-03-05   495   1.1.1  add exception catcher to EventLoop
17
// 2013-02-22   491   1.1    use new RlogFile/RlogMsg interfaces
18
// 2013-01-12   474   1.0    Initial Version
19
// ---------------------------------------------------------------------------
20
 
21
/*!
22
  \file
23
  \version $Id: RlinkServerEventLoop.cpp 495 2013-03-06 17:13:48Z mueller $
24
  \brief   Implemenation of RlinkServerEventLoop.
25
*/
26
 
27
#include <errno.h>
28
 
29
#include "RlinkServer.hpp"
30
#include "librtools/RlogMsg.hpp"
31
 
32
#include "RlinkServerEventLoop.hpp"
33
 
34
using namespace std;
35
 
36
/*!
37
  \class Retro::RlinkServerEventLoop
38
  \brief FIXME_docs
39
*/
40
 
41
// all method definitions in namespace Retro
42
namespace Retro {
43
 
44
//------------------------------------------+-----------------------------------
45
//! Default constructor
46
 
47
RlinkServerEventLoop::RlinkServerEventLoop(RlinkServer* pserv)
48
  : fpServer(pserv)
49
{}
50
 
51
//------------------------------------------+-----------------------------------
52
//! Destructor
53
 
54
RlinkServerEventLoop::~RlinkServerEventLoop()
55
{}
56
 
57
//------------------------------------------+-----------------------------------
58
//! FIXME_docs
59
 
60
void RlinkServerEventLoop::EventLoop()
61
{
62
  fLoopActive = true;
63
  fUpdatePoll = true;
64
 
65
  if (fspLog && fTraceLevel>0) fspLog->Write("eloop: starting", 'I');
66
 
67
  try {
68
    while (fLoopActive) {
69
      int timeout = (fpServer->AttnPending() ||
70
                     fpServer->ActnPending()) ? 0 : -1;
71
      int irc = DoPoll(timeout);
72
      fpServer->fStats.Inc(timeout<0 ? RlinkServer::kStatNEloopWait :
73
                           RlinkServer::kStatNEloopPoll);
74
      if (fPollFd.size() == 0) break;
75
      if (irc > 0) DoCall();
76
 
77
      if (fpServer->AttnPending()) fpServer->CallAttnHandler();
78
      if (fpServer->ActnPending()) fpServer->CallActnHandler();
79
    }
80
  } catch (exception& e) {
81
    if (fspLog) {
82
      RlogMsg lmsg(*fspLog, 'F');
83
      lmsg << "eloop: crashed with exception: " << e.what();
84
    }
85
    return;
86
  }
87
 
88
  if (fspLog && fTraceLevel>0) fspLog->Write("eloop: stopped", 'I');
89
 
90
  return;
91
}
92
 
93
} // end namespace Retro

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.