@@ -255,7 +255,6 @@ rust_task_thread::start_main_loop() {
255
255
reap_dead_tasks ();
256
256
}
257
257
258
- A (this , newborn_tasks.is_empty (), " Should have no newborn tasks" );
259
258
A (this , running_tasks.is_empty (), " Should have no running tasks" );
260
259
A (this , blocked_tasks.is_empty (), " Should have no blocked tasks" );
261
260
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,
280
279
DLOG (this , task, " created task: " PTR " , spawner: %s, name: %s" ,
281
280
task, spawner ? spawner->name : " null" , name);
282
281
283
- {
284
- scoped_lock with (lock);
285
- newborn_tasks.append (task);
286
- }
287
-
288
282
task->id = kernel->generate_task_id ();
289
283
return task;
290
284
}
291
285
292
286
rust_task_list *
293
287
rust_task_thread::state_list (rust_task_state state) {
294
288
switch (state) {
295
- case task_state_newborn:
296
- return &newborn_tasks;
297
289
case task_state_running:
298
290
return &running_tasks;
299
291
case task_state_blocked:
300
292
return &blocked_tasks;
301
293
case task_state_dead:
302
294
return &dead_tasks;
295
+ default :
296
+ return NULL ;
303
297
}
304
298
}
305
299
@@ -330,8 +324,14 @@ rust_task_thread::transition(rust_task *task,
330
324
name, (uintptr_t )this , state_name (src), state_name (dst),
331
325
state_name (task->get_state ()));
332
326
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
+ }
335
335
task->set_state (dst, cond, cond_name);
336
336
337
337
lock.signal ();
0 commit comments