以下是对应的状态机说明:
0到4分别表示:CREATED, TERMINATED,RUNNABLE,
RUNNING 和 NON_RUNNABLE
THREAD = CREATED, CREATED = (start ->RUNNABLE |stop ->TERMINATED), RUNNING = ({suspend,sleep}->NON_RUNNABLE |yield ->RUNNABLE |{stop, end} ->TERMINATED | run ->RUNNING), RUNNABLE = (suspend ->NON_RUNNABLE | dispatch ->RUNNING |stop ->TERMINATED), NON_RUNNABLE = (resume ->RUNNABLE |stop ->TERMINATED), TERMINATED = STOP.
说明:本内容摘自 <<Concurrency: State Models & Java Programs (2nd Edition)>>
时间: 2024-10-01 01:22:39