_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)