Skip to content

Commit 96f5654

Browse files
committed
rt: Make fields of rust_task_thread private where possible
1 parent b6c57db commit 96f5654

File tree

2 files changed

+36
-39
lines changed

2 files changed

+36
-39
lines changed

src/rt/rust_task_thread.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ rust_task_thread::rust_task_thread(rust_scheduler *sched,
2323
int id) :
2424
rust_thread(SCHED_STACK_SIZE),
2525
_log(srv, this),
26-
log_lvl(log_debug),
26+
cache(this),
27+
id(id),
28+
should_exit(false),
29+
cached_c_stack(NULL),
30+
kernel(sched->kernel),
31+
sched(sched),
2732
srv(srv),
28-
// TODO: calculate a per scheduler name.
29-
name("main"),
3033
newborn_tasks(this, "newborn"),
3134
running_tasks(this, "running"),
3235
blocked_tasks(this, "blocked"),
3336
dead_tasks(this, "dead"),
34-
cache(this),
35-
kernel(sched->kernel),
36-
sched(sched),
37-
id(id),
37+
log_lvl(log_debug),
3838
min_stack_size(kernel->env->min_stack_size),
3939
env(kernel->env),
40-
should_exit(false),
41-
cached_c_stack(NULL)
40+
// TODO: calculate a per scheduler name.
41+
name("main")
4242
{
4343
LOGPTR(this, "new dom", (uintptr_t)this);
4444
isaac_init(kernel, &rctx);

src/rt/rust_task_thread.h

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,14 @@ class rust_crate_cache {
4545
struct rust_task_thread : public kernel_owned<rust_task_thread>,
4646
rust_thread
4747
{
48+
private:
4849

4950
// Fields known only by the runtime:
5051
rust_log _log;
5152

52-
// NB: this is used to filter *runtime-originating* debug
53-
// logging, on a per-scheduler basis. It's not likely what
54-
// you want to expose to the user in terms of per-task
55-
// or per-module logging control. By default all schedulers
56-
// are set to debug-level logging here, and filtered by
57-
// runtime category using the pseudo-modules ::rt::foo.
58-
uint32_t log_lvl;
59-
60-
rust_srv *srv;
61-
const char *const name;
62-
63-
rust_task_list newborn_tasks;
64-
rust_task_list running_tasks;
65-
rust_task_list blocked_tasks;
66-
rust_task_list dead_tasks;
67-
6853
rust_crate_cache cache;
69-
70-
randctx rctx;
71-
72-
rust_kernel *kernel;
73-
rust_scheduler *sched;
74-
int32_t list_index;
75-
7654
const int id;
7755

78-
lock_and_signal lock;
79-
size_t min_stack_size;
80-
8156
#ifndef __WIN32__
8257
pthread_attr_t attr;
8358
static pthread_key_t task_key;
@@ -86,21 +61,43 @@ struct rust_task_thread : public kernel_owned<rust_task_thread>,
8661
#endif
8762

8863
static bool tls_initialized;
89-
90-
rust_env *env;
9164
context c_context;
9265

9366
bool should_exit;
9467

95-
private:
96-
9768
stk_seg *cached_c_stack;
9869
stk_seg *extra_c_stack;
9970

10071
void prepare_c_stack(rust_task *task);
10172
void unprepare_c_stack();
10273

10374
public:
75+
rust_kernel *kernel;
76+
rust_scheduler *sched;
77+
rust_srv *srv;
78+
79+
lock_and_signal lock;
80+
81+
rust_task_list newborn_tasks;
82+
rust_task_list running_tasks;
83+
rust_task_list blocked_tasks;
84+
rust_task_list dead_tasks;
85+
86+
// NB: this is used to filter *runtime-originating* debug
87+
// logging, on a per-scheduler basis. It's not likely what
88+
// you want to expose to the user in terms of per-task
89+
// or per-module logging control. By default all schedulers
90+
// are set to debug-level logging here, and filtered by
91+
// runtime category using the pseudo-modules ::rt::foo.
92+
uint32_t log_lvl;
93+
94+
size_t min_stack_size;
95+
rust_env *env;
96+
97+
randctx rctx;
98+
99+
int32_t list_index;
100+
const char *const name;
104101

105102
// Only a pointer to 'name' is kept, so it must live as long as this
106103
// domain.

0 commit comments

Comments
 (0)