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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [src/] [librlink/] [RlinkServerEventLoop.cpp] - Rev 40

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

// $Id: RlinkServerEventLoop.cpp 495 2013-03-06 17:13:48Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for complete details.
// 
// Revision History: 
// Date         Rev Version  Comment
// 2013-03-05   495   1.1.1  add exception catcher to EventLoop
// 2013-02-22   491   1.1    use new RlogFile/RlogMsg interfaces
// 2013-01-12   474   1.0    Initial Version
// ---------------------------------------------------------------------------
 
/*!
  \file
  \version $Id: RlinkServerEventLoop.cpp 495 2013-03-06 17:13:48Z mueller $
  \brief   Implemenation of RlinkServerEventLoop.
*/
 
#include <errno.h>
 
#include "RlinkServer.hpp"
#include "librtools/RlogMsg.hpp"
 
#include "RlinkServerEventLoop.hpp"
 
using namespace std;
 
/*!
  \class Retro::RlinkServerEventLoop
  \brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Default constructor
 
RlinkServerEventLoop::RlinkServerEventLoop(RlinkServer* pserv)
  : fpServer(pserv)
{}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
RlinkServerEventLoop::~RlinkServerEventLoop()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void RlinkServerEventLoop::EventLoop()
{
  fLoopActive = true;
  fUpdatePoll = true;
 
  if (fspLog && fTraceLevel>0) fspLog->Write("eloop: starting", 'I');
 
  try {
    while (fLoopActive) {
      int timeout = (fpServer->AttnPending() || 
                     fpServer->ActnPending()) ? 0 : -1;
      int irc = DoPoll(timeout);
      fpServer->fStats.Inc(timeout<0 ? RlinkServer::kStatNEloopWait : 
                           RlinkServer::kStatNEloopPoll);
      if (fPollFd.size() == 0) break;
      if (irc > 0) DoCall();
 
      if (fpServer->AttnPending()) fpServer->CallAttnHandler();
      if (fpServer->ActnPending()) fpServer->CallActnHandler();
    }
  } catch (exception& e) {
    if (fspLog) {
      RlogMsg lmsg(*fspLog, 'F');
      lmsg << "eloop: crashed with exception: " << e.what();
    }
    return;
  }
 
  if (fspLog && fTraceLevel>0) fspLog->Write("eloop: stopped", 'I');
 
  return;
}
 
} // end namespace Retro
 

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

powered by: WebSVN 2.1.0

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