- Change pkg-config file to use ${prefix}/include

rather thant ${prefix}/include/sgpemv2: users will
be able to use directives like "#include <sgpemv2/scheduler.hh>"
in their headers, which reduces name clashes.
- Make _mutex a protected member of Singleton, so that
inheriters can recycle it :-)
- Add exclusive access control for step_forward()
- Add two states (future and exhausted) to Request


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@707 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-04 10:03:43 +00:00
parent 899e20323a
commit 736aa25456
5 changed files with 23 additions and 11 deletions

View File

@ -14,4 +14,4 @@ URL: http://www.math.unipd.it/
Requires: glibmm-2.4 >= 2.8 gthread-2.0 >= 2.8
Libs: -L${libdir} -lbackend
Libs.private: -lglibmm-2.4 -lgthread-2.0
Cflags: -I${includedir}/sgpemv2
Cflags: -I${includedir}

View File

@ -35,8 +35,10 @@ namespace sgpem
public:
enum state
{
state_ready,
state_allocated
state_ready = 1 << 0,
state_allocated = 1 << 1,
state_future = 1 << 2,
state_exhausted = 1 << 3
};
virtual ~Request();

View File

@ -30,6 +30,8 @@
// Do not include full template definition in the header file
#include "singleton.tcc"
#include <glibmm/thread.h>
#include <memory>
using namespace std;
using namespace sgpem;
@ -114,6 +116,12 @@ Scheduler::get_policy()
void
Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterruptException)
{
// This very method should be exclusive: no concurrent behaviour, from when we
// store a readyqueue and policy pointer for the user-policy to retrieve, to when
// the policy returns
// TODO: restrict this area to maximise parallelism
Glib::Mutex::Lock lock(_mutex);
// NOTE: Be sure to read the *ORIGINAL* documentation in the design document for this method!
// FIXME: handle me! I'm not just a pretty boolean, I want to be *USED*! *EXPLOITED*!
@ -161,12 +169,15 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
// 3. check for simulation termination (we can directly use threads
// for this check, since processes' state is based upon threads' one)
if(simulation_ended &&
((*it)->get_state() & (Schedulable::state_blocked |
if( /* we still think that */ simulation_ended &&
(current.get_state() & (Schedulable::state_blocked |
Schedulable::state_terminated)) == 0)
simulation_ended = false;
}
// What to do now if the simulation ended?
// FIXME: increasing the time elapsed of the running thread + process
// should maybe be done here as the first thing, instead than
// directly when selecting them

View File

@ -29,9 +29,6 @@ namespace sgpem
#include "config.h"
#include <limits>
#include <iostream>
#include "history.hh"
#include "policy.hh"
#include "ready_queue.hh"

View File

@ -45,9 +45,11 @@ namespace sgpem
*/
static Instantiated_class& get_instance();
protected:
static Glib::StaticMutex SG_DLLLOCAL _mutex;
private:
static Instantiated_class* _instance;
static Glib::StaticMutex SG_DLLLOCAL _mutex;
}
; //~ class Singleton