sgpemv2/src/backend/dynamic_thread.hh
tchernobog d128ee8608 - Fix portability issues with config.h header. Now it is
included by the compiler (via a flag) and the visibility
macros have been moved to a separate header. You'll
probably need to cleanup your source dir and re-run autogen.sh
before compiling sgpem again.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1191 3ecf2c5c-341e-0410-92b4-d18e462d057c
2006-09-16 13:34:43 +00:00

92 lines
2.4 KiB
C++

// src/backend/dynamic_thread.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 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 more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef DYNAMIC_THREAD_HH
#define DYNAMIC_THREAD_HH 1
#include "gettext.h"
#include "glibmm/ustring.h"
#include <vector>
#include <sgpemv2/thread.hh>
#include "dynamic_process.hh"
#include "dynamic_schedulable.hh"
#include <sgpemv2/templates/smartp.hh>
namespace sgpem
{
class DynamicThread;
class DynamicProcess;
class StaticThread;
class Request;
class DynamicRequest;
class SG_DLLLOCAL DynamicThread : public DynamicSchedulable, public Thread
{
public:
DynamicThread(StaticThread* core, DynamicProcess* parent);
DynamicThread(const DynamicThread &other, DynamicProcess* parent);
virtual ~DynamicThread();
DynamicProcess& get_process();
state get_state() const;
state set_state(state new_state);
int get_last_acquisition() const;
void set_last_acquisition(int instant);
int get_last_release() const;
void set_last_release(int instant);
unsigned int get_elapsed_time() const;
void decrease_remaining_time();
std::vector<Request*> get_requests();
void serialize(SerializeVisitor& translator) const;
virtual StaticThread& get_core();
virtual const StaticThread& get_core() const;
// Does also the job of "add_request" and "remove_request"
std::vector<DynamicRequest*>& get_dynamic_requests();
private:
// Undefined
DynamicThread(const DynamicThread &other);
memory::smart_ptr<StaticThread> _core;
state _state;
std::vector<DynamicRequest*> _dynamic_requests;
DynamicProcess* _parent;
unsigned int _ran_for;
int _last_acquisition;
int _last_release;
};
}
#endif