ThreadX-thread

_tx_thread_create

(TX_THREAD *thread_ptr, CHAR *name,
VOID(*entry_function)(), ULONG entry_input, VOID *stack_start,
ULONG stack_size, UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start);

TX_INTERRUPT_SAVE_AREA
TX_THREAD_PTR tail_ptr

thread_name = name
thread_entry = entry_function
entry_parameter = entry_input
stack_ptr = TX_NULL
stack_start = stack_start.
stack_size = stack_size

stack_end=stack_start+stack_size+1
tx_priority = priority
tx_preempt_threshold

tx_run_count =0
tx_state = tx_suspended.
tx_delayed_suspend = TX_FALSE
tx_suspending = TX_FALSE

Setup the nessary fields in the thread timer block
tx_timeout_function = txthreadtimeout
tx_timeout_param = thread_ptr
tx_list_head = TX_NULL
tx_re_initialize_ticks = 0

tx_suspend_cleanup = NULL
suspend_control_block = NULL
suspend_next = NULL
suspend_previous =NULL

tx_priority_bit = (ULONG)1<<priority;

tx_thread_stack_build(thread_ptr, _tx_thread_shell_entry)

TX_DISABLE
thread_ptr->d = tx_threadid

_tx_thread_created_ptr ==== threadptr

TX_RESTORE

_tx_thread_delete

if (thread_ptr->tx_state == TX_COMPLETED || == == TX_TERMINATED==)

_tx_thread_preemption_change(&my_thread, 0, &my_old_threshold)

tx_thread_priority_change()

Thread Sleep
tx_thread_sleep(timer_tick)

/* Determine if this is a legal request */

/Determine if the requested number of ticks is zero/

TX_DISABLE
tx_state = TX_SLEEP
tx_suspending = TX_TRUE
tx_thread_preempt_disable++
TX_RESTORE

tx_remaining_ticks = timer_tick
tx_timer_active(timer).
tx_thread_suspend(tx_thread_current_ptr)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值