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 53 54 55 56 57 58 59 60 61 62 63 64
|
/* $Id$
*
* WakeAt: Tell the scheduler to wake the current process at a given
* simulation time.
*
* Copyright (C) 2008-2009 FAUmachine Team <info@faumachine.org>.
* This program is free software. You can redistribute it and/or modify it
* under the terms of the GNU General Public License, either version 2 of
* the License, or (at your option) any later version. See COPYING.
*/
#ifndef __WAKE_AT_HPP_INCLUDED
#define __WAKE_AT_HPP_INCLUDED
#include <cassert>
namespace intermediate {
//! register that the current process should be resumed at a given time.
/** This class will tell the scheduler, to resume the current process
* at a given time. The scheduler may however also resume the current
* process earlier, in case a signal registered via WakeOn had an
* event.
* In case the process resumes due to an event, the timeout is also
* cleared, and must eventually get reset.
* Issueing more than one WakeAt before a call to Suspend the current
* process leads to undefined behaviour.
*
* read operands: wakeTime
* write operands: no explicit write operands
*
* Operation: sched->setTimeOut(wakeTime);
*/
class WakeAt : public OpCode {
public:
//! c'tor
/** @param t simulation time value, at which the process should
* resume.
*/
WakeAt(Operand *t) : wakeTime(t) {
assert(t->type == OP_TYPE_INTEGER);
}
//! Accept a Visitor.
/** All intermediate code nodes need to implement this method.
*
* @param v the Visitor that can visit this node.
*/
virtual void accept(Visitor& v) {
v.visit(*this);
}
//! scheduled resume time.
Operand *wakeTime;
protected:
virtual ~WakeAt() {
util::MiscUtil::terminate(this->wakeTime);
}
};
}; /* namespace intermediate */
#endif /* __WAKE_AT_HPP_INCLUDED */
|