rt: Extract rust_thread_sched_launcher from rust_sched_launcher
This commit is contained in:
parent
a17097a57b
commit
de47fcfdf9
@ -5,8 +5,14 @@ const size_t SCHED_STACK_SIZE = 1024*100;
|
||||
|
||||
rust_sched_launcher::rust_sched_launcher(rust_scheduler *sched,
|
||||
rust_srv *srv, int id)
|
||||
: rust_thread(SCHED_STACK_SIZE),
|
||||
kernel(sched->kernel),
|
||||
: kernel(sched->kernel),
|
||||
sched_loop(sched, srv, id),
|
||||
driver(&sched_loop) {
|
||||
}
|
||||
|
||||
rust_thread_sched_launcher::rust_thread_sched_launcher(rust_scheduler *sched,
|
||||
rust_srv *srv, int id)
|
||||
: rust_sched_launcher(sched, srv, id),
|
||||
rust_thread(SCHED_STACK_SIZE) {
|
||||
}
|
||||
|
||||
|
@ -5,23 +5,33 @@
|
||||
#include "sync/rust_thread.h"
|
||||
#include "rust_sched_driver.h"
|
||||
|
||||
class rust_sched_launcher
|
||||
: public kernel_owned<rust_sched_launcher>,
|
||||
private rust_thread {
|
||||
class rust_sched_launcher : public kernel_owned<rust_sched_launcher> {
|
||||
public:
|
||||
rust_kernel *kernel;
|
||||
|
||||
private:
|
||||
rust_sched_loop sched_loop;
|
||||
|
||||
protected:
|
||||
rust_sched_driver driver;
|
||||
|
||||
public:
|
||||
rust_sched_launcher(rust_scheduler *sched, rust_srv *srv, int id);
|
||||
|
||||
void start() { rust_thread::start(); }
|
||||
void run() { driver.start_main_loop(); }
|
||||
void join() { rust_thread::join(); }
|
||||
virtual void start() = 0;
|
||||
virtual void run() = 0;
|
||||
virtual void join() = 0;
|
||||
rust_sched_loop *get_loop() { return &sched_loop; }
|
||||
};
|
||||
|
||||
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 run() { driver.start_main_loop(); }
|
||||
virtual void join() { rust_thread::join(); }
|
||||
};
|
||||
|
||||
#endif // RUST_SCHED_LAUNCHER_H
|
||||
|
@ -26,7 +26,8 @@ rust_sched_launcher *
|
||||
rust_scheduler::create_task_thread(int id) {
|
||||
rust_srv *srv = this->srv->clone();
|
||||
rust_sched_launcher *thread =
|
||||
new (kernel, "rust_sched_launcher") rust_sched_launcher(this, srv, id);
|
||||
new (kernel, "rust_thread_sched_launcher")
|
||||
rust_thread_sched_launcher(this, srv, id);
|
||||
KLOG(kernel, kern, "created task thread: " PTR ", id: %d",
|
||||
thread, id);
|
||||
return thread;
|
||||
|
Loading…
Reference in New Issue
Block a user