提交 3fcd9f14 编写于 作者: N NEEN

!189 fixed the bug #I381L0

* update docs-en/kernel/thread.md.
* update kernel/线程.md.
上级 2ed134d2
......@@ -44,10 +44,9 @@ A high-priority thread in a process can preempt the resources of a low-priority
When a running thread is blocked \(for example, is pended, delayed, or reading semaphores\), the thread is deleted from the ready list, and its state changes from **Running** to **Blocked**. Then, a thread switchover is triggered to run the thread with the highest priority in the ready list.
- Blocked→Ready/Blocked→Running:
After the blocked thread is restored \(for example, the thread is restored, the delay times out, the semaphore reading times out, or semaphores have been read\), the thread is added to the ready list and changes from the **Blocked** state to the **Ready** state. In this case, if the priority of the restored thread is higher than that of the running thread, a thread switchover occurs to run the restored thread, and therefore the restored thread changes from the **Ready** state to the **Running** state.
- Blocked→Ready:
After the blocked thread is restored \(for example, the thread is restored, the delay times out, the semaphore reading times out, or semaphores have been read\), the thread is added to the ready list and changes from the **Blocked** state to the **Ready** state.
- Ready→Blocked:
A thread may also be blocked \(suspended\) in the **Ready** state. The blocked thread will change from the **Ready** state to the **Blocked** state and is deleted from the ready list. In this case, the thread will not be scheduled until it is restored.
......@@ -60,9 +59,6 @@ A high-priority thread in a process can preempt the resources of a low-priority
When a running thread is terminated, its state changes from **Running** to **Exit**. The thread without the **PTHREAD\_CREATE\_DETACHED** attribute will present the **Exit** state after being terminated.
- Blocked→Exit:
If an API is called to delete a blocked thread, the thread changes from the **Blocked** state to the **Exit** state.
## When to Use<a name="section44877547404"></a>
......
......@@ -44,9 +44,9 @@ OpenHarmony内核的线程一共有32个优先级\(0-31\),最高优先级为0
正在运行的线程发生阻塞(挂起、延时、读信号量等)时,该线程会从就绪列表中删除,线程状态由运行态变成阻塞态,然后发生线程切换,运行就绪列表中剩余最高优先级线程。
- Blocked→Ready / Blocked→Running
- Blocked→Ready:
阻塞的线程被恢复后(线程恢复、延时时间超时、读信号量超时或读到信号量等),此时被恢复的线程会被加入就绪列表,从而由阻塞态变成就绪态;此时如果被恢复线程的优先级高于正在运行线程的优先级,则会发生线程切换,将该线程由就绪态变成运行态
阻塞的线程被恢复后(线程恢复、延时时间超时、读信号量超时或读到信号量等),此时被恢复的线程会被加入就绪列表,从而由阻塞态变成就绪态。
- Ready→Blocked:
......@@ -60,9 +60,6 @@ OpenHarmony内核的线程一共有32个优先级\(0-31\),最高优先级为0
运行中的线程运行结束,线程状态由运行态变为退出态。若未设置分离属性(PTHREAD\_CREATE\_DETACHED)的线程,运行结束后对外呈现的是Exit状态,即退出态。
- Blocked→Exit:
阻塞的线程调用删除接口,线程状态由阻塞态变为退出态。
## 使用场景<a name="section44877547404"></a>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册