
context switch用來保存thead狀態- 可在記憶體任何地方(由user自行分配)
read only- Debug用(tx_api.h)
tx_thread_run_count
|
Thread's run counter
|
tx_thread_state
|
Thread's execution state
TX_READY
TX_COMPLETED
TX_TERMINATED
TX_SUSPENDED
TX_SLEEP
TX_QUEUE_SUSP
TX_SEMAPHORE_SUSP
TX_EVENT_FLAG
TX_BLOCK_MEMORY
TX_BYTE_MEMORY
TX_MUTEX_SUSP
Note:
|
Thread service
|
Description
|
tx_thread_create
|
Create an application thread
Note:
|
tx_thread_delete
|
Delete an
application thread
只在TX_COMPLETED/TX_TERMINATED狀態下操作
|
tx_thread_entry_exit_notify
|
Notify application upon
|
tx_thread_identify
|
Retrieves
pointer to currently executing thread
|
tx_thread_info_get
|
Retrieve
information about a thread
資訊與TCB相似
|
tx_thread_performance_info_get
|
Get thread performance information
|
tx_thread_performance_system_info_get
|
Get thread system performance information
|
tx_thread_preemption_change
|
Change
preemption-threshold of application
|
tx_thread_priority_change
|
Change priority of an application thread
會將thread
priority threshold給disable
|
tx_thread_relinquish
|
Relinquish
control to other application threads
|
tx_thread_reset
|
Reset thread to original status
|
tx_thread_resume
|
Resume suspended application thread
|
tx_thread_sleep
|
Suspend
|
tx_thread_stack_error_notify
|
Register
thread stack error notification callback
|
tx_thread_suspend
|
Suspend an application thread
|
tx_thread_terminate
|
Terminates an application thread
|
tx_thread_time_slice_change
|
|
tx_thread_wait_abort
|
Abort suspension of specified thread
無法恢復被強制supspend的thread(tx_thread_suspend)
|
Tips
how to fine tune stack size? - 宣告一足夠大的stack並填上特定值(如0xEFEF)
create thread and run- 完整測試
- 查看有多少stack沒被用到
- Reentrant
- thread其中一個特點是,同一個function可能會有多個thread來使用,此時就需要保證為reeentrant,其中:
- 不能使用靜態變數
( global, static)