f9micro / f9-kernel

An efficient and secure microkernel built for ARM Cortex-M cores, inspired by L4
Other
683 stars 145 forks source link

Thread Removal: Fix thread could not be removed. #84

Closed georgekang closed 10 years ago

georgekang commented 10 years ago

Fixes #74

sys_thread_control: Now, utcb is used only for thread creation. Move its checking for thread creation.

thread_destroy: Because "parent" is usually equal to "caller", we should remove "thr" first and then move its children to "caller". Otherwise, "parent->t_child" may be assigned to "thr->t_child". Then, it is incorrect to remove "thr" from "parent->t_child".

georgekang commented 10 years ago

Fix Result: The following two threads are deleted after a little time. [USR] 00804001 00000040 SEND 00800002 [USR] 00808001 00000080 RECV 00800002

====================================================
      Copyright(C) 2013 The F9 Microkernel Project  
====================================================
Git head: 409f95fbc19aae0081faa71accf4bfd342c00aec
Host: x86_64
Build: 2014-04-07T11:42:42+0800

Press '?' to print KDB menu

L4/Pistachio test suite starts

Simple IPC test (inter-as, only untyped words)
  Send Message transfer:   OK
  ReplyWait Message transfer:   OK
Returned Id 0 != 0 (local) [0 (global)]
  From parameter (local):   FAILED

## KDB ##
-------THREADS------
type  global   local    state  parent
IDLE  00000000 00000000 RUN    00000000
ROOT  00008000 00000000 RECV   00000000
KERN  00004000 00000000 RUN    00000000
[USR] 00800002 00000040 RECV   00008000
[USR] 00400002 00000080 RECV   00008000
[USR] 00804001 00000040 SEND   00800002
[USR] 00808001 00000080 RECV   00800002
[USR] 00404002 00000040 SEND   00400002
[USR] 00408002 00000080 RECV   00400002
----------------

## KDB ##

## KDB ##
-------THREADS------
type  global   local    state  parent
IDLE  00000000 00000000 RUN    00000000
ROOT  00008000 00000000 RECV   00000000
KERN  00004000 00000000 RUN    00000000
[USR] 00800002 00000040 RECV   00008000
[USR] 00400002 00000080 RECV   00008000
[USR] 00404002 00000040 RUN    00400002
[USR] 00408002 00000080 RECV   00400002
----------------