Skip to content

Commit 6f6650e

Browse files
committed
rt: Remove rust_task_thread::newborn_tasks
1 parent 5d4bf75 commit 6f6650e

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/rt/rust_task_thread.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ rust_task_thread::start_main_loop() {
255255
reap_dead_tasks();
256256
}
257257

258-
A(this, newborn_tasks.is_empty(), "Should have no newborn tasks");
259258
A(this, running_tasks.is_empty(), "Should have no running tasks");
260259
A(this, blocked_tasks.is_empty(), "Should have no blocked tasks");
261260
A(this, dead_tasks.is_empty(), "Should have no dead tasks");
@@ -280,26 +279,21 @@ rust_task_thread::create_task(rust_task *spawner, const char *name,
280279
DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s",
281280
task, spawner ? spawner->name : "null", name);
282281

283-
{
284-
scoped_lock with(lock);
285-
newborn_tasks.append(task);
286-
}
287-
288282
task->id = kernel->generate_task_id();
289283
return task;
290284
}
291285

292286
rust_task_list *
293287
rust_task_thread::state_list(rust_task_state state) {
294288
switch (state) {
295-
case task_state_newborn:
296-
return &newborn_tasks;
297289
case task_state_running:
298290
return &running_tasks;
299291
case task_state_blocked:
300292
return &blocked_tasks;
301293
case task_state_dead:
302294
return &dead_tasks;
295+
default:
296+
return NULL;
303297
}
304298
}
305299

@@ -330,8 +324,14 @@ rust_task_thread::transition(rust_task *task,
330324
name, (uintptr_t)this, state_name(src), state_name(dst),
331325
state_name(task->get_state()));
332326
I(this, task->get_state() == src);
333-
state_list(src)->remove(task);
334-
state_list(dst)->append(task);
327+
rust_task_list *src_list = state_list(src);
328+
if (src_list) {
329+
src_list->remove(task);
330+
}
331+
rust_task_list *dst_list = state_list(dst);
332+
if (dst_list) {
333+
dst_list->append(task);
334+
}
335335
task->set_state(dst, cond, cond_name);
336336

337337
lock.signal();

src/rt/rust_task_thread.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct rust_task_thread : public kernel_owned<rust_task_thread>,
4747
stk_seg *cached_c_stack;
4848
stk_seg *extra_c_stack;
4949

50-
rust_task_list newborn_tasks;
5150
rust_task_list running_tasks;
5251
rust_task_list blocked_tasks;
5352
rust_task_list dead_tasks;

0 commit comments

Comments
 (0)