Fix compilation warnings and a couple of errors due to GCC -pedantic flags
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1329 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
61df7cd551
commit
99135b1237
|
@ -501,7 +501,9 @@ src_testsuite_test_statistics_LDFLAGS = \
|
|||
src_testsuite_test_statistics_SOURCES = \
|
||||
src/backend/statistics.cc \
|
||||
src/backend/concrete_process_statistics.cc \
|
||||
src/backend/concrete_thread_statistics.cc \
|
||||
src/backend/concrete_simulation_statistics.cc \
|
||||
src/backend/concrete_statistics.cc \
|
||||
src/testsuite/test-statistics.cc
|
||||
|
||||
|
||||
|
|
|
@ -240,11 +240,10 @@ $ac_distutils_result])
|
|||
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
|
||||
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
|
||||
AC_LANG_PUSH([C])
|
||||
AC_TRY_LINK(AC_LANG_PROGRAM([
|
||||
#include <Python.h>
|
||||
],[
|
||||
Py_Initialize();
|
||||
]),[pythonexists=yes],[pythonexists=no])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[#include <Python.h>]],
|
||||
[[Py_Initialize();]])
|
||||
],[pythonexists=yes],[pythonexists=no])
|
||||
AC_LANG_POP([C])
|
||||
# turn back to default flags
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
|
|
|
@ -91,12 +91,12 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio
|
|||
|
||||
PythonCPUPolicy::~PythonCPUPolicy()
|
||||
{
|
||||
if (_adapter) Py_DECREF(_adapter);
|
||||
if (_adapter) { Py_DECREF(_adapter); }
|
||||
|
||||
// We keep this alive until dtor time, because
|
||||
// the user may have defined some static global-space
|
||||
// variables and they make use of them.
|
||||
if (_upolicy_dict) Py_DECREF(_upolicy_dict);
|
||||
if (_upolicy_dict) { Py_DECREF(_upolicy_dict); }
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -135,7 +135,7 @@ PythonCPUPolicy::configure() throw(UserInterruptException, MalformedPolicyExcept
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_configure", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_configure"), NULL);
|
||||
Py_DECREF(retval);
|
||||
|
||||
wait_unlock();
|
||||
|
@ -150,7 +150,7 @@ PythonCPUPolicy::sort_queue() const throw(UserInterruptException, MalformedPolic
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_sort_queue", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_sort_queue"), NULL);
|
||||
|
||||
// Do minimal debugging
|
||||
if (!retval) PyErr_Print();
|
||||
|
@ -181,13 +181,13 @@ PythonCPUPolicy::is_pre_emptive() const throw(UserInterruptException, MalformedP
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_is_preemptive", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_is_preemptive"), NULL);
|
||||
Py_DECREF(retval);
|
||||
|
||||
wait_unlock();
|
||||
|
||||
// Parse return value stored in global Python object
|
||||
retval = PyObject_CallMethod(_adapter, "get_return_value", NULL);
|
||||
retval = PyObject_CallMethod(_adapter, const_cast<char*>("get_return_value"), NULL);
|
||||
assert(retval);
|
||||
bool ret = PyObject_IsTrue(retval);
|
||||
Py_DECREF(retval);
|
||||
|
@ -203,7 +203,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_get_time_slice", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_get_time_slice"), NULL);
|
||||
|
||||
// Do minimal debugging
|
||||
if (!retval) PyErr_Print();
|
||||
|
@ -212,7 +212,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP
|
|||
wait_unlock();
|
||||
|
||||
// Parse return value stored in global Python object
|
||||
retval = PyObject_CallMethod(_adapter, "get_return_value", NULL);
|
||||
retval = PyObject_CallMethod(_adapter, const_cast<char*>("get_return_value"), NULL);
|
||||
assert(retval);
|
||||
long tmp = PyInt_AsLong(retval);
|
||||
Py_DECREF(retval);
|
||||
|
@ -239,7 +239,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli
|
|||
Glib::usleep(wait_for); // hack'a'ton! magggggiccc nummmbeeerrrrrs!!
|
||||
Py_BLOCK_THREADS;
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "mutex_test_lock", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("mutex_test_lock"), NULL);
|
||||
assert(retval);
|
||||
still_locked = PyObject_IsTrue(retval);
|
||||
Py_DECREF(retval);
|
||||
|
@ -263,7 +263,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli
|
|||
|
||||
// check if there were unhandled exception in the user-defined code
|
||||
|
||||
PyObject* pException = PyObject_CallMethod(_adapter, "get_last_exception", NULL);
|
||||
PyObject* pException = PyObject_CallMethod(_adapter, const_cast<char*>("get_last_exception"), NULL);
|
||||
|
||||
if(pException != NULL)
|
||||
{
|
||||
|
@ -325,9 +325,9 @@ PythonCPUPolicy::get_exception_information()
|
|||
else
|
||||
msg = string(_("no available information for this error"));
|
||||
|
||||
if (pType != NULL) Py_DECREF(pType);
|
||||
if (pValue != NULL) Py_DECREF(pValue);
|
||||
if (pTraceback != NULL) Py_DECREF(pTraceback);
|
||||
if (pType != NULL) { Py_DECREF(pType); }
|
||||
if (pValue != NULL) { Py_DECREF(pValue); }
|
||||
if (pTraceback != NULL) { Py_DECREF(pTraceback); }
|
||||
|
||||
PyErr_Clear();
|
||||
|
||||
|
|
|
@ -139,66 +139,13 @@ void XMLSerializer::fill_doc(xmlDocPtr doc, const History& hist)
|
|||
*/
|
||||
xmlDtdPtr dtd = xmlCreateIntSubset(doc, (const xmlChar *) "sgpem", NULL, (const xmlChar *) "sgpem.dtd");
|
||||
|
||||
//TODO: check for DTD compliance??
|
||||
|
||||
XMLVisitor xvisit(root_node);
|
||||
xvisit.from_history(hist);
|
||||
/*
|
||||
//
|
||||
// xmlNewChild() creates a new node, which is "attached" as child node
|
||||
// of root_node node.
|
||||
//
|
||||
xmlNodePtr resources_node = xmlNewChild(root_node, NULL, (const xmlChar *) "resources", NULL);
|
||||
//
|
||||
// The same as above, but the new child node doesn't have a content
|
||||
//
|
||||
xmlNodePtr schedulables_node = xmlNewChild(root_node, NULL, (const xmlChar *) "schedulables", NULL);
|
||||
|
||||
fill_resources(resources_node, hist);
|
||||
fill_schedulables(schedulables_node, hist);
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
void XMLSerializer::fill_resources(xmlNodePtr resources_node, const History& hist)
|
||||
{
|
||||
|
||||
|
||||
const Environment& env = hist.get_last_environment();
|
||||
|
||||
const Environment::Resources& rvect = env.get_resources();
|
||||
typedef Environment::Resources::const_iterator res_iterator;
|
||||
|
||||
res_iterator iter = rvect.begin();
|
||||
res_iterator end = rvect.end();
|
||||
while(iter!=end)
|
||||
{
|
||||
XMLVisitor xvisit(resources_node);
|
||||
Glib::ustring key;
|
||||
int_to_string((int)(*iter).first, key);
|
||||
xvisit.from_resource(*((*iter).second), key);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
void XMLSerializer::fill_schedulables(xmlNodePtr schedulables_node, const History& hist)
|
||||
{
|
||||
|
||||
|
||||
const Environment& env = hist.get_last_environment();
|
||||
|
||||
const Environment::Processes& pvect = env.get_processes();
|
||||
typedef std::vector<Process*>::const_iterator proc_iterator;
|
||||
|
||||
proc_iterator iter = pvect.begin();
|
||||
proc_iterator end = pvect.end();
|
||||
while(iter!=end)
|
||||
{
|
||||
XMLVisitor xvisit(schedulables_node);
|
||||
xvisit.from_process(*(*iter));
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(SerializerError)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -86,7 +86,7 @@ XMLSerializerFactory::create_resource(Parameters& parameters)
|
|||
int arrival_time = 0;
|
||||
int how_many = 1;
|
||||
bool preemptable = false;
|
||||
int old_key;
|
||||
int old_key = 0;
|
||||
Parameters::iterator pos;
|
||||
|
||||
// read "name" property
|
||||
|
|
|
@ -44,7 +44,7 @@ XMLVisitor::~XMLVisitor()
|
|||
{
|
||||
}
|
||||
|
||||
void XMLVisitor::from_resource(const Resource& obj) throw(SerializerError)
|
||||
void XMLVisitor::from_resource(const Resource& /*obj*/) throw(SerializerError)
|
||||
{
|
||||
throw SerializerError(
|
||||
_("XMLVisitor: unsupported method from_resource(const Resource& obj)")
|
||||
|
@ -203,8 +203,7 @@ void XMLVisitor::from_process(xmlNodePtr parent, const Process& obj) throw(Seria
|
|||
while (iter != end)
|
||||
{
|
||||
const Thread* t = *iter;
|
||||
|
||||
from_thread(threads_node, *(*iter));
|
||||
from_thread(threads_node, *t);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
@ -244,8 +243,7 @@ void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) throw(Seriali
|
|||
while (iter != end)
|
||||
{
|
||||
const Request* r = *iter;
|
||||
|
||||
from_request(requests_node, *(*iter));
|
||||
from_request(requests_node, *r);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +276,7 @@ void XMLVisitor::from_request(xmlNodePtr parent, const Request& obj) throw(Seria
|
|||
while (iter != end)
|
||||
{
|
||||
const SubRequest* sr = *iter;
|
||||
from_subrequest(request_node, *(*iter));
|
||||
from_subrequest(request_node, *sr);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,9 +307,9 @@ ConcreteHistory::clear()
|
|||
|
||||
ConcreteHistory::ResourcePair
|
||||
ConcreteHistory::add_resource(const Glib::ustring& name,
|
||||
bool preemptable,
|
||||
bool /*preemptable*/,
|
||||
size_t places,
|
||||
size_t availability)
|
||||
size_t /*availability*/)
|
||||
{
|
||||
typedef ConcreteEnvironment::Resources Resources;
|
||||
typedef ConcreteEnvironment::SubRequestQueue SubRequestQueue;
|
||||
|
@ -341,9 +341,9 @@ ConcreteHistory::add_resource(const Glib::ustring& name,
|
|||
void
|
||||
ConcreteHistory::edit_resource(Resource& resource,
|
||||
const Glib::ustring& name,
|
||||
bool preemptable,
|
||||
bool /*preemptable*/,
|
||||
size_t places,
|
||||
size_t availability)
|
||||
size_t /*availability*/)
|
||||
{
|
||||
// And preemptable and availability?? FIXME!
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace sgpem
|
|||
This class is a direct subclass of the abstract class ProcessStatistics.
|
||||
For the documentation af all methods refere to it.
|
||||
*/
|
||||
class ConcreteProcessStatistics : public ProcessStatistics
|
||||
class SG_DLLLOCAL ConcreteProcessStatistics : public ProcessStatistics
|
||||
{
|
||||
public:
|
||||
friend class ConcreteStatistics;
|
||||
|
|
|
@ -168,10 +168,12 @@ ConcreteSimulation::step()
|
|||
// step forward
|
||||
bool yet_to_finish = true;
|
||||
if (_history.get_front() == _history.get_size() - 1)
|
||||
{
|
||||
if(!_history.is_sealed())
|
||||
yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy(), *get_resource_policy());
|
||||
else
|
||||
yet_to_finish = false;
|
||||
}
|
||||
|
||||
if (!yet_to_finish) _history.seal();
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define CONCRETE_SIMULATION_HH 1
|
||||
|
||||
|
||||
|
||||
#include <sgpemv2/simulation.hh>
|
||||
#include "concrete_history.hh"
|
||||
|
||||
|
@ -35,7 +34,7 @@ namespace sgpem
|
|||
{
|
||||
class ConcreteSimulation;
|
||||
|
||||
class ConcreteSimulation : public Simulation
|
||||
class SG_DLLLOCAL ConcreteSimulation : public Simulation
|
||||
{
|
||||
public:
|
||||
ConcreteSimulation();
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace sgpem
|
|||
This class is a direct subclass of the abstract class SimulationStatistics.
|
||||
For the documentation af all methods refere to it.
|
||||
*/
|
||||
class ConcreteSimulationStatistics : public SimulationStatistics
|
||||
class SG_DLLLOCAL ConcreteSimulationStatistics : public SimulationStatistics
|
||||
{
|
||||
public:
|
||||
friend class ConcreteStatistics;
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace sgpem
|
|||
This class is a direct subclass of the abstract class Statistics.
|
||||
For the documentation af all methods refere to it.
|
||||
*/
|
||||
class ConcreteStatistics : public Statistics
|
||||
class SG_DLLLOCAL ConcreteStatistics : public Statistics
|
||||
{
|
||||
public:
|
||||
ConcreteStatistics();
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace sgpem
|
|||
This class is a direct subclass of the abstract class ThreadStatistics.
|
||||
For the documentation af all methods refere to it.
|
||||
*/
|
||||
class ConcreteThreadStatistics : public ThreadStatistics
|
||||
class SG_DLLLOCAL ConcreteThreadStatistics : public ThreadStatistics
|
||||
{
|
||||
public:
|
||||
friend class ConcreteProcessStatistics;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace sgpem
|
|||
/**
|
||||
ResourcePolicyManager is the Abstract Factory for \ref ResourcePolicy objects.
|
||||
*/
|
||||
class CppResourcePolicyManager : public ResourcePolicyManager
|
||||
class SG_DLLLOCAL CppResourcePolicyManager : public ResourcePolicyManager
|
||||
{
|
||||
public:
|
||||
/** \brief CppResourcePolicyManager constructor
|
||||
|
|
|
@ -41,7 +41,7 @@ using std::runtime_error;
|
|||
using namespace sgpem;
|
||||
|
||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||
template class SG_DLLEXPORT Singleton<CPUPoliciesGatekeeper>;
|
||||
template class Singleton<CPUPoliciesGatekeeper>;
|
||||
|
||||
typedef vector<CPUPolicyManager*>::iterator ManagerIterator;
|
||||
typedef map<History*, CPUPolicy*>::iterator ActiveIterator;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
using namespace sgpem;
|
||||
|
||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||
template class SG_DLLEXPORT Singleton<GlobalPreferences>;
|
||||
template class Singleton<GlobalPreferences>;
|
||||
|
||||
GlobalPreferences::GlobalPreferences()
|
||||
: _mod_dirs(1, PLUGDIR), _pol_dirs(1, POLDIR), _speed(1000)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// src/backend/key_file.hh - Copyright 2005, 2006, University
|
||||
// src/backend/global_preferences_serializer.hh - Copyright 2005, 2006, University
|
||||
// of Padova, dept. of Pure and Applied
|
||||
// Mathematics
|
||||
//
|
||||
|
@ -36,7 +36,7 @@ namespace sgpem
|
|||
* in the form of: key=value rows.
|
||||
*
|
||||
*/
|
||||
class SG_DLLEXPORT GlobalPreferencesSerializer : public KeyFile
|
||||
class SG_DLLLOCAL GlobalPreferencesSerializer : public KeyFile
|
||||
{
|
||||
|
||||
public:
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
using namespace sgpem;
|
||||
|
||||
template class SG_DLLEXPORT Singleton<PluginManager>;
|
||||
template class Singleton<PluginManager>;
|
||||
|
||||
|
||||
std::vector<Module*>
|
||||
|
|
|
@ -40,7 +40,7 @@ using std::runtime_error;
|
|||
using namespace sgpem;
|
||||
|
||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||
template class SG_DLLEXPORT Singleton<ResourcePoliciesGatekeeper>;
|
||||
template class Singleton<ResourcePoliciesGatekeeper>;
|
||||
|
||||
typedef vector<ResourcePolicyManager*>::iterator ManagerIterator;
|
||||
typedef map<History*, ResourcePolicy*>::iterator PolicyIterator;
|
||||
|
|
|
@ -35,7 +35,7 @@ ResourcePolicyFiFo::configure()
|
|||
}
|
||||
|
||||
void
|
||||
ResourcePolicyFiFo::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
ResourcePolicyFiFo::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
throw(UserInterruptException)
|
||||
{
|
||||
typedef Environment::SubRequestQueue SubRequestQueue;
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace sgpem
|
|||
It's a Strategy wich stay for a resource allocating algorithm.
|
||||
It implements the related resource allocation policy.
|
||||
*/
|
||||
class ResourcePolicyFiFo : public ResourcePolicy
|
||||
class SG_DLLLOCAL ResourcePolicyFiFo : public ResourcePolicy
|
||||
{
|
||||
public:
|
||||
virtual ~ResourcePolicyFiFo();
|
||||
|
|
|
@ -34,7 +34,7 @@ ResourcePolicyLiFo::configure()
|
|||
}
|
||||
|
||||
void
|
||||
ResourcePolicyLiFo::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
ResourcePolicyLiFo::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
throw(UserInterruptException)
|
||||
{
|
||||
typedef Environment::SubRequestQueue SubRequestQueue;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace sgpem
|
|||
It's a Strategy wich stay for a resource allocating algorithm.
|
||||
It implements the related resource allocation policy.
|
||||
*/
|
||||
class ResourcePolicyLiFo : public ResourcePolicy
|
||||
class SG_DLLLOCAL ResourcePolicyLiFo : public ResourcePolicy
|
||||
{
|
||||
public:
|
||||
virtual ~ResourcePolicyLiFo();
|
||||
|
|
|
@ -36,7 +36,7 @@ ResourcePolicyPriority::configure()
|
|||
}
|
||||
|
||||
void
|
||||
ResourcePolicyPriority::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
ResourcePolicyPriority::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
throw(UserInterruptException)
|
||||
{
|
||||
typedef Environment::SubRequestQueue SubRequestQueue;
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace sgpem
|
|||
/// following the priority of the owners of the requests.
|
||||
class ResourcePolicyPriority;
|
||||
|
||||
class ResourcePolicyPriority : public ResourcePolicy
|
||||
class SG_DLLLOCAL ResourcePolicyPriority : public ResourcePolicy
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ ResourcePolicyPriorityInheritance::configure()
|
|||
}
|
||||
|
||||
void
|
||||
ResourcePolicyPriorityInheritance::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
ResourcePolicyPriorityInheritance::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr)
|
||||
throw(UserInterruptException)
|
||||
{
|
||||
typedef Environment::SubRequestQueue SubRequestQueue;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace sgpem
|
|||
* \brief It's a Strategy wich stay for a resource allocating algorithm.
|
||||
* It implements the related resource allocation policy.
|
||||
*/
|
||||
class ResourcePolicyPriorityInheritance : public ResourcePolicy
|
||||
class SG_DLLLOCAL ResourcePolicyPriorityInheritance : public ResourcePolicy
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ using namespace std;
|
|||
using namespace sgpem;
|
||||
|
||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||
template class SG_DLLEXPORT Singleton<Scheduler>;
|
||||
template class Singleton<Scheduler>;
|
||||
|
||||
|
||||
typedef std::vector<DynamicProcess*> Processes;
|
||||
|
@ -69,8 +69,6 @@ static void terminate_all_requests_of(DynamicThread& thread, ConcreteEnvironment
|
|||
static void update_allocated_requests(DynamicThread& running_thread, ConcreteEnvironment& environment);
|
||||
static void raise_new_requests(DynamicThread& running_thread, ConcreteEnvironment& environment, ResourcePolicy& resource_policy);
|
||||
static void look_for_mutant_request_states(ConcreteEnvironment& environment, unsigned int& alive_threads);
|
||||
static void determine_subr_allocable_status(const DynamicRequest& req, DynamicSubRequest& subr,
|
||||
const Resource& res, SubRequestQueue& queue);
|
||||
static void determine_subr_allocable_status(const Resource& res, const SubRequestQueue& queue);
|
||||
|
||||
|
||||
|
@ -268,69 +266,6 @@ raise_new_requests(DynamicThread& running_thread, ConcreteEnvironment& environme
|
|||
}
|
||||
|
||||
|
||||
// The following loop determines how many places in the resource are
|
||||
// really available for a thread, and how many places for a specific
|
||||
// resource a thread really needs. Admittedly, it's a bit of a hack (in
|
||||
// the way it's written, not conceptually!)
|
||||
void
|
||||
determine_subr_allocable_status(const DynamicRequest& req, DynamicSubRequest& subr,
|
||||
const Resource& res, SubRequestQueue& queue)
|
||||
{
|
||||
unsigned int total_places = res.get_places();
|
||||
unsigned int free_places = total_places;
|
||||
unsigned int needed_places = 0;
|
||||
|
||||
unsigned int position_in_queue = 0;
|
||||
bool too_far_in_the_queue = false;
|
||||
const SubRequestQueue& const_queue = queue;
|
||||
for(Iseq<SubRequestQueue::const_iterator> queue_it = iseq(const_queue);
|
||||
queue_it && free_places >= needed_places; queue_it++, position_in_queue++)
|
||||
{
|
||||
SubRequest& sr = **queue_it;
|
||||
if(sr.get_state() == Request::state_allocated)
|
||||
{
|
||||
assert(free_places > 0); // Just to be sure...
|
||||
free_places--;
|
||||
}
|
||||
// Okay, this won't win a beauty contest...
|
||||
if(&sr.get_request() == &req)
|
||||
needed_places++;
|
||||
// Well, and what about this, then?
|
||||
if(&sr == &subr && position_in_queue + 1 > total_places)
|
||||
too_far_in_the_queue = true;
|
||||
|
||||
} //~ for(over subrequest queue)
|
||||
|
||||
// If the number of places this thread need for a resource are
|
||||
// less or equal the places left free, it's allocable.
|
||||
if(needed_places <= free_places && !too_far_in_the_queue)
|
||||
subr.set_state(Request::state_allocable);
|
||||
else
|
||||
{
|
||||
subr.set_state(Request::state_unallocable);
|
||||
/*
|
||||
// Okay, this is difficult to understand, so read carefully:
|
||||
// when we make a subrequest unallocable, it means that the
|
||||
// whole request is unallocable. However, it may happen that
|
||||
// there are other subrequests just marked allocable for
|
||||
// a given resource. Since a request is atomic, either we're
|
||||
// given *all* the places we asked for in a resource, or none.
|
||||
// This doesn't affect the state for other subrequests on other
|
||||
// resources, which may stay (atomically) allocable.
|
||||
// (Maybe it was better to implement the number of "places"
|
||||
// needed directly into subrequests, after all...)
|
||||
for(Iseq<SubRequestQueue::iterator> queue_it = iseq(queue); queue_it; queue_it++)
|
||||
{
|
||||
DynamicSubRequest& x = static_cast<DynamicSubRequest&>(**queue_it);
|
||||
if(&x.get_request() == &req && x.get_state() == Request::state_allocable)
|
||||
x.set_state(Request::state_unallocable);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// The following loop updates the states of the subrequests depending
|
||||
// on their position in the queue
|
||||
void
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <sgpemv2/sgpemv2-visibility.hh>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "glibmm/ustring.h"
|
||||
|
@ -34,7 +35,7 @@ namespace sgpem
|
|||
class SG_DLLEXPORT PolicyParametersException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
PolicyParametersException(char* msg): std::runtime_error(msg) {}
|
||||
PolicyParametersException(std::string msg): std::runtime_error(msg) {}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
using namespace sgpem;
|
||||
|
||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||
template class SG_DLLEXPORT Singleton<ConcreteSimulation>;
|
||||
template class Singleton<ConcreteSimulation>;
|
||||
|
||||
Simulation::Simulation()
|
||||
: _notify(true)
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace sgpem
|
|||
|
||||
It IS a Schedulable object.
|
||||
*/
|
||||
class StaticProcess : public StaticSchedulable
|
||||
class SG_DLLLOCAL StaticProcess : public StaticSchedulable
|
||||
{
|
||||
public:
|
||||
/** \brief Creates a new object with the given parameters. */
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace sgpem
|
|||
class StaticRequest;
|
||||
class SerializeVisitor;
|
||||
|
||||
class StaticRequest
|
||||
class SG_DLLLOCAL StaticRequest
|
||||
{
|
||||
public:
|
||||
StaticRequest(StaticThread* thread, unsigned int instant);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef STATIC_RESOURCE_HH
|
||||
#define STATIC_RESOURCE_HH 1
|
||||
|
||||
#include <sgpemv2/sgpemv2-visibility.hh>
|
||||
|
||||
#include "glibmm/ustring.h"
|
||||
|
||||
|
@ -39,7 +40,7 @@ namespace sgpem
|
|||
/// copy constructor private. This makes clear that if you want to edit a
|
||||
/// static entity, you should reset the ::History, remove the old static
|
||||
/// entity, and create a new dynamic entity for the new static one.
|
||||
class StaticResource
|
||||
class SG_DLLLOCAL StaticResource
|
||||
{
|
||||
public:
|
||||
/// \brief Constructor taking a defined name and a number of places.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef STATIC_SCHEDULABLE_HH
|
||||
#define STATIC_SCHEDULABLE_HH 1
|
||||
|
||||
#include <sgpemv2/sgpemv2-visibility.hh>
|
||||
|
||||
#include "glibmm/ustring.h"
|
||||
|
||||
|
@ -38,7 +39,7 @@ namespace sgpem
|
|||
*
|
||||
* \see DynamicSchedulable
|
||||
*/
|
||||
class StaticSchedulable
|
||||
class SG_DLLLOCAL StaticSchedulable
|
||||
{
|
||||
public:
|
||||
/** \brief Create a new object with the given parameters */
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace sgpem
|
|||
class StaticRequest;
|
||||
class StaticResource;
|
||||
|
||||
class StaticSubRequest
|
||||
class SG_DLLLOCAL StaticSubRequest
|
||||
{
|
||||
public:
|
||||
typedef SubRequest::resource_key_t resource_key_t;
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace sgpem
|
|||
/// at which its creation in the operating system is simulated.
|
||||
class StaticThread;
|
||||
|
||||
class StaticThread : public StaticSchedulable
|
||||
class SG_DLLLOCAL StaticThread : public StaticSchedulable
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <gdkmm/window.h>
|
||||
|
||||
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
|
@ -110,8 +110,10 @@ CairoWidget::on_realize()
|
|||
set_window(window);
|
||||
window->set_user_data(gobj());
|
||||
|
||||
gtk_style_attach(get_style()->gobj(), window->gobj());
|
||||
get_style()->set_background(window, Gtk::STATE_ACTIVE);
|
||||
|
||||
Glib::RefPtr<Gtk::Style> style = get_style ();
|
||||
style = style->attach (window);
|
||||
style->set_background(window, Gtk::STATE_ACTIVE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <glibmm/timer.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <ios>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
|
Loading…
Reference in New Issue