閆剛 nuttx workqueue實現原理

2021-09-26 07:06:16 字數 1125 閱讀 9462

使用注意

nuttx_wqueue.md

優點:最短時間排程

缺點:工作佇列執行完後,需要重新建立.

static

intwork_qqueue

(far struct usr_wqueue_s *wqueue,

far struct work_s *work, worker_t worker,

far void

*arg, systime_t delay)

->

dq_addlast

((far dq_entry_t *

)work,

&wqueue->q)

;

void

work_process

(far struct kwork_wqueue_s *wqueue, systime_t period,

int wndx)

work =

(far struct work_s *

)work->dq.flink;

//工作佇列的物件的時間小於hpwork佇列時間,則使用任務呼叫的時間period: 100ms

elapsed =

clock_systimer()

- stick;

if(elapsed < period && next >0)

注意佇列中必須設計非阻塞的介面,不能呼叫poll型別的非阻塞介面

work_queue中,注意開啟控制代碼的時候,一定在callback中開啟,

因為在callback外開啟檔案控制代碼屬於nsh,而不屬於work_queue.

所以如果呼叫fd在callback外部開啟

會導致,收發資料不正常。 類如px4的hmc5883在work_queue中的measure奇怪的寫法:

公告主題和發布資料在1個函式中實現,和mpu6000中的公告發布不一致的問題.

if

(_mag_topic !=

nullptr

)else

}

閆剛 ygOS任務管理

task manage.md void ygos tcb create int prio,void task void p arg void p arg,uint32 t ptos 作業系統初始化,為tcb分配記憶體空間,同時啟動空閒任務 ygos init 建立使用者任務 ygos tcb cre...

閆剛 Android線性布局講解

file xml xmlns android android layout width match parent android layout height match parent android orientation vertical android id id button1 android...

閆剛 git版本控制tag使用

git tag使用 我們的軟體開發到某個階段,可以建立發行版本,現在gitee和github上的可以自動顯示你tag打包後的 發行版本,很方便。建立tag git tag a cct v1.1.0 beta m 新硬體v2,色溫模式 檢視tag git tag 推送tag到遠端分支 git push...