2012-03-29 17:21:32 -05:00
|
|
|
#ifndef RUST_SCHED_LAUNCHER_H
|
|
|
|
#define RUST_SCHED_LAUNCHER_H
|
|
|
|
|
|
|
|
#include "rust_internal.h"
|
|
|
|
#include "sync/rust_thread.h"
|
2012-03-30 19:10:02 -05:00
|
|
|
#include "rust_sched_driver.h"
|
2012-03-29 17:21:32 -05:00
|
|
|
|
2012-04-01 00:00:08 -05:00
|
|
|
class rust_sched_launcher : public kernel_owned<rust_sched_launcher> {
|
2012-03-29 17:21:32 -05:00
|
|
|
public:
|
|
|
|
rust_kernel *kernel;
|
|
|
|
|
|
|
|
private:
|
2012-03-29 18:31:30 -05:00
|
|
|
rust_sched_loop sched_loop;
|
2012-04-01 00:00:08 -05:00
|
|
|
|
|
|
|
protected:
|
2012-03-30 19:10:02 -05:00
|
|
|
rust_sched_driver driver;
|
2012-03-29 17:21:32 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
rust_sched_launcher(rust_scheduler *sched, rust_srv *srv, int id);
|
2012-04-01 15:25:49 -05:00
|
|
|
virtual ~rust_sched_launcher() { }
|
2012-03-29 17:21:32 -05:00
|
|
|
|
2012-04-01 00:00:08 -05:00
|
|
|
virtual void start() = 0;
|
|
|
|
virtual void join() = 0;
|
2012-03-29 18:31:30 -05:00
|
|
|
rust_sched_loop *get_loop() { return &sched_loop; }
|
2012-03-29 17:21:32 -05:00
|
|
|
};
|
|
|
|
|
2012-04-01 00:00:08 -05:00
|
|
|
class rust_thread_sched_launcher
|
|
|
|
:public rust_sched_launcher,
|
|
|
|
private rust_thread {
|
|
|
|
public:
|
|
|
|
rust_thread_sched_launcher(rust_scheduler *sched, rust_srv *srv, int id);
|
|
|
|
virtual void start() { rust_thread::start(); }
|
|
|
|
virtual void join() { rust_thread::join(); }
|
2012-04-01 18:21:48 -05:00
|
|
|
virtual void run() { driver.start_main_loop(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
class rust_manual_sched_launcher : public rust_sched_launcher {
|
|
|
|
public:
|
|
|
|
rust_manual_sched_launcher(rust_scheduler *sched, rust_srv *srv, int id);
|
|
|
|
virtual void start() { }
|
|
|
|
virtual void join() { }
|
|
|
|
void start_main_loop() { driver.start_main_loop(); }
|
2012-04-01 00:00:08 -05:00
|
|
|
};
|
|
|
|
|
2012-04-01 19:22:24 -05:00
|
|
|
class rust_sched_launcher_factory {
|
|
|
|
public:
|
|
|
|
virtual ~rust_sched_launcher_factory() { }
|
|
|
|
virtual rust_sched_launcher *
|
|
|
|
create(rust_scheduler *sched, int id) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class rust_thread_sched_launcher_factory
|
|
|
|
: public rust_sched_launcher_factory {
|
|
|
|
public:
|
|
|
|
virtual rust_sched_launcher *create(rust_scheduler *sched, int id);
|
|
|
|
};
|
|
|
|
|
2012-04-01 19:35:35 -05:00
|
|
|
class rust_manual_sched_launcher_factory
|
|
|
|
: public rust_sched_launcher_factory {
|
|
|
|
private:
|
|
|
|
rust_manual_sched_launcher *launcher;
|
|
|
|
public:
|
|
|
|
rust_manual_sched_launcher_factory() : launcher(NULL) { }
|
|
|
|
virtual rust_sched_launcher *create(rust_scheduler *sched, int id);
|
|
|
|
rust_manual_sched_launcher *get_launcher() { return launcher; }
|
|
|
|
};
|
|
|
|
|
2012-03-29 17:21:32 -05:00
|
|
|
#endif // RUST_SCHED_LAUNCHER_H
|