- Only schedule Threads. Ditch support for Policies deciding
if they want to schedule Threads or Processes altogether - Move setter methods for last_acquisition/last_release from DynamicSchedulable to DynamicThread - Rewrite aforesaid methods, along with the respective getter methods, into Dynamic(Thread|Process) git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@708 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
736aa25456
commit
a378239d60
17 changed files with 119 additions and 194 deletions
|
@ -47,9 +47,6 @@ namespace std {
|
|||
|
||||
namespace sgpem {
|
||||
|
||||
/** Don't get worried, order is not important! */
|
||||
enum policy_sorts_type { policy_sorts_threads, policy_sorts_processes };
|
||||
|
||||
class Policy {
|
||||
public:
|
||||
virtual ~Policy() = 0;
|
||||
|
@ -154,7 +151,7 @@ namespace sgpem {
|
|||
};
|
||||
|
||||
virtual unsigned int get_arrival_time() const = 0;
|
||||
virtual unsigned int get_remaining_time() const = 0;
|
||||
virtual unsigned int get_elapsed_time() const = 0;
|
||||
virtual int get_base_priority() const = 0;
|
||||
virtual int get_current_priority() const = 0;
|
||||
virtual unsigned int get_total_cpu_time() const = 0;
|
||||
|
@ -198,25 +195,7 @@ namespace sgpem {
|
|||
|
||||
size_t size() const;
|
||||
|
||||
// Dynamic cast to Process or to Thread so
|
||||
// that Python code sees the extra-methods
|
||||
%typename(out) sgpem::Schedulable*;
|
||||
{
|
||||
// OMG, Ponies!!
|
||||
Process* proc;
|
||||
Thread* thread;
|
||||
if((proc = dynamic_cast<Process*>($1)) != NULL)
|
||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(proc),
|
||||
SWIGTYPE_p_sgpem__Process, 0 | 0 );
|
||||
else if((thread = dynamic_cast<Thread*>($1)) != NULL)
|
||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(thread),
|
||||
SWIGTYPE_p_sgpem__Thread, 0 | 0 );
|
||||
else // Fall back to Schedulable* if no dynamic_cast went well:
|
||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(thread),
|
||||
$1_descriptor, 0 | 0 );
|
||||
}
|
||||
|
||||
sgpem::Schedulable* get_item_at(position index);
|
||||
sgpem::Thread* get_item_at(position index);
|
||||
|
||||
%typename(out) sgpem::Schedulable*;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue