rt: Extract rust_sched_launcher from rust_task_thread

rust_sched_launcher is actually responsible for setting up the thread and
starting the loop. There will be other implementations that do not actually
set up a new thread, in order to support scheduling tasks on the main OS
thread.
This commit is contained in:
Brian Anderson
2012-03-29 15:21:32 -07:00
parent 620b4d4946
commit 6bf8d19712
7 changed files with 71 additions and 37 deletions

View File

@@ -13,7 +13,6 @@ pthread_key_t rust_task_thread::task_key;
DWORD rust_task_thread::task_key;
#endif
const size_t SCHED_STACK_SIZE = 1024*100;
const size_t C_STACK_SIZE = 1024*1024;
bool rust_task_thread::tls_initialized = false;
@@ -21,7 +20,6 @@ bool rust_task_thread::tls_initialized = false;
rust_task_thread::rust_task_thread(rust_scheduler *sched,
rust_srv *srv,
int id) :
rust_thread(SCHED_STACK_SIZE),
_log(srv, this),
id(id),
should_exit(false),
@@ -256,6 +254,8 @@ rust_task_thread::start_main_loop() {
destroy_stack(kernel->region(), cached_c_stack);
cached_c_stack = NULL;
}
sched->release_task_thread();
}
rust_task *
@@ -327,11 +327,6 @@ rust_task_thread::transition(rust_task *task,
lock.signal();
}
void rust_task_thread::run() {
this->start_main_loop();
sched->release_task_thread();
}
#ifndef _WIN32
void
rust_task_thread::init_tls() {