Threadx 02 服務函式

2021-10-05 18:01:49 字數 2320 閱讀 5887

4.2 tx_byte相關函式

4.3 tx_mutex相關函式

4.4 tx_event_flag相關函式

4.5 tx_timer相關函式

4.7 tx_queue

void

(void

*first_unused_memory)

uint tx_thread_delete

(tx_thread *thread_ptr)

該服務刪除指定的應用程式執行緒。 自指定執行緒必須處於終止或完成狀態,該服務不能從試圖刪除自身的執行緒中呼叫。

將當前的thread掛起 n 個timer_ticks。

uint tx_thread_terminate

(tx_thread *thread_ptr)

該服務終止指定的應用程式執行緒,無論執行緒是否被掛起。 執行緒可以呼叫此服務來終止自身。

tx_byte_pool_create

(&byte_pool_0,

"byte pool 0"

, first_unused_memory, demo_byte_pool_size)

;//9120btye

tx_byte_allocate

(&byte_pool_0,

(void **)

&pointer, demo_stack_size, tx_no_wait)

;//分配1024byte

該服務在指定的區域中建立乙個記憶體位元組池,然後分配給pointer。

mutex內訪問的資源,其他的執行緒不可以再去訪問。

tx_mutex_create

(&my_mutex,

"my_mutex"

, tx_no_inherit)

;

該服務嘗試獲取指定互斥鎖的獨佔所有權。 如果呼叫執行緒已經擁有該互斥鎖,則將增加乙個內部計數器,並返回成功狀態。

如果互斥鎖由另乙個執行緒擁有,並且該執行緒具有更高的優先順序,並且在建立互斥鎖時指定了優先順序繼承,則優先順序較低的執行緒的優先順序將暫時提高到呼叫執行緒的優先順序。

tx_mutex_get

(&my_mutex, tx_wait_forever)

;

得到互斥量

tx_mutex_put

(&my_mutex)

;

uint tx_event_flags_create

(tx_event_flags_group *group_ptr, char *name_ptr)

uint tx_event_flags_get

(tx_event_flags_group *group_ptr,ulong requested_flags, \

uint get_option,ulong *actual_flags_ptr, ulong wait_option)

uint tx_event_flags_set

(tx_event_flags_group *group_ptr,ulong flags_to_set,uint set_option)

tx_timer_create (

&stats_timer,

"stats_timer"

, print_stats,

0x1234

,500

,500

, tx_auto_activate)

;

start_time =

tx_time_get()

;

tx_queue_create (

&my_queue,

"my_queue"

, queue_msg_size,

queue_storage, queue_total_size)

;

uint tx_queue_send

(tx_queue *queue_ptr,

void *source_ptr, ulong wait_option)

uint tx_queue_receive

(tx_queue *queue_ptr,

void *destination_ptr, ulong wait_option)

Hive常用函式02

select size citys from test where privince guangdong test 表中 privince是guangdong這一行的citys的大小 select map keys citys from test where privince guangdong t...

02 輔助函式二

檢測郵箱是否合法 1 defcheck email email 2import re3 res re.match r 0 9a za z 0 9a za z 0 9a za z 0 9a za z email 4return true if res else false 檢測手機號碼是否合法 1 d...

函式傳引數 Kotlin 02 函式

訪問控制符 fun 函式名 引數列表.返回值型別 else 如上 宣告 函式 fun1 需要乙個引數 value 返回 boolean 型別的值。kotlin 中函式的引數 用name type的形式定義,多個引數之間使用 逗號 分割,每個引數必須顯示的指定資料型別 fun fun2 p1 stri...