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:
|
2012-04-01 22:18:40 -05:00
|
|
|
rust_sched_launcher(rust_scheduler *sched, 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:
|
2012-04-01 22:18:40 -05:00
|
|
|
rust_thread_sched_launcher(rust_scheduler *sched, int id);
|
2012-04-01 00:00:08 -05:00
|
|
|
virtual void start() { rust_thread::start(); }
|
|
|
|
virtual void run() { driver.start_main_loop(); }
|
|
|
|
virtual void join() { rust_thread::join(); }
|
|
|
|
};
|
|
|
|
|
2012-03-29 17:21:32 -05:00
|
|
|
#endif // RUST_SCHED_LAUNCHER_H
|