rt: Convert rust_task_list to a typedef
This commit is contained in:
2
mk/rt.mk
2
mk/rt.mk
@@ -45,7 +45,6 @@ RUNTIME_CS_$(1) := \
|
|||||||
rt/rust_scheduler.cpp \
|
rt/rust_scheduler.cpp \
|
||||||
rt/rust_task.cpp \
|
rt/rust_task.cpp \
|
||||||
rt/rust_stack.cpp \
|
rt/rust_stack.cpp \
|
||||||
rt/rust_task_list.cpp \
|
|
||||||
rt/rust_port.cpp \
|
rt/rust_port.cpp \
|
||||||
rt/rust_upcall.cpp \
|
rt/rust_upcall.cpp \
|
||||||
rt/rust_uv.cpp \
|
rt/rust_uv.cpp \
|
||||||
@@ -83,7 +82,6 @@ RUNTIME_HDR_$(1) := rt/globals.h \
|
|||||||
rt/rust_shape.h \
|
rt/rust_shape.h \
|
||||||
rt/rust_task.h \
|
rt/rust_task.h \
|
||||||
rt/rust_stack.h \
|
rt/rust_stack.h \
|
||||||
rt/rust_task_list.h \
|
|
||||||
rt/rust_log.h \
|
rt/rust_log.h \
|
||||||
rt/rust_port_selector.h \
|
rt/rust_port_selector.h \
|
||||||
rt/circular_buffer.h \
|
rt/circular_buffer.h \
|
||||||
|
|||||||
@@ -145,8 +145,6 @@ template <typename T> struct region_owned {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "rust_task_list.h"
|
|
||||||
|
|
||||||
// A cond(ition) is something we can block on. This can be a channel
|
// A cond(ition) is something we can block on. This can be a channel
|
||||||
// (writing), a port (reading) or a task (waiting).
|
// (writing), a port (reading) or a task (waiting).
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
#include "rust_internal.h"
|
|
||||||
|
|
||||||
rust_task_list::rust_task_list (rust_task_thread *thread) :
|
|
||||||
thread(thread) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
rust_task_list::delete_all() {
|
|
||||||
DLOG(thread, task, "deleting all tasks");
|
|
||||||
while (is_empty() == false) {
|
|
||||||
rust_task *task = pop_value();
|
|
||||||
DLOG(thread, task, "deleting task " PTR, task);
|
|
||||||
delete task;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
// -*- c++ -*-
|
|
||||||
#ifndef RUST_TASK_LIST_H
|
|
||||||
#define RUST_TASK_LIST_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to indicate the state of a rust task.
|
|
||||||
*/
|
|
||||||
class rust_task_list : public indexed_list<rust_task>,
|
|
||||||
public kernel_owned<rust_task_list> {
|
|
||||||
public:
|
|
||||||
rust_task_thread *thread;
|
|
||||||
rust_task_list (rust_task_thread *thread);
|
|
||||||
void delete_all();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* RUST_TASK_LIST_H */
|
|
||||||
@@ -27,10 +27,6 @@ rust_task_thread::rust_task_thread(rust_scheduler *sched,
|
|||||||
id(id),
|
id(id),
|
||||||
should_exit(false),
|
should_exit(false),
|
||||||
cached_c_stack(NULL),
|
cached_c_stack(NULL),
|
||||||
newborn_tasks(this),
|
|
||||||
running_tasks(this),
|
|
||||||
blocked_tasks(this),
|
|
||||||
dead_tasks(this),
|
|
||||||
kernel(sched->kernel),
|
kernel(sched->kernel),
|
||||||
sched(sched),
|
sched(sched),
|
||||||
srv(srv),
|
srv(srv),
|
||||||
@@ -47,15 +43,6 @@ rust_task_thread::rust_task_thread(rust_scheduler *sched,
|
|||||||
init_tls();
|
init_tls();
|
||||||
}
|
}
|
||||||
|
|
||||||
rust_task_thread::~rust_task_thread() {
|
|
||||||
DLOG(this, dom, "~rust_task_thread %s @0x%" PRIxPTR, name, (uintptr_t)this);
|
|
||||||
|
|
||||||
newborn_tasks.delete_all();
|
|
||||||
running_tasks.delete_all();
|
|
||||||
blocked_tasks.delete_all();
|
|
||||||
dead_tasks.delete_all();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_task_thread::activate(rust_task *task) {
|
rust_task_thread::activate(rust_task *task) {
|
||||||
task->ctx.next = &c_context;
|
task->ctx.next = &c_context;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ enum rust_task_state {
|
|||||||
task_state_dead
|
task_state_dead
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef indexed_list<rust_task> rust_task_list;
|
||||||
|
|
||||||
struct rust_task_thread : public kernel_owned<rust_task_thread>,
|
struct rust_task_thread : public kernel_owned<rust_task_thread>,
|
||||||
rust_thread
|
rust_thread
|
||||||
{
|
{
|
||||||
@@ -80,7 +82,6 @@ public:
|
|||||||
// Only a pointer to 'name' is kept, so it must live as long as this
|
// Only a pointer to 'name' is kept, so it must live as long as this
|
||||||
// domain.
|
// domain.
|
||||||
rust_task_thread(rust_scheduler *sched, rust_srv *srv, int id);
|
rust_task_thread(rust_scheduler *sched, rust_srv *srv, int id);
|
||||||
~rust_task_thread();
|
|
||||||
void activate(rust_task *task);
|
void activate(rust_task *task);
|
||||||
void log(rust_task *task, uint32_t level, char const *fmt, ...);
|
void log(rust_task *task, uint32_t level, char const *fmt, ...);
|
||||||
rust_log & get_log();
|
rust_log & get_log();
|
||||||
|
|||||||
Reference in New Issue
Block a user