mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 06:17:35 +08:00
px4_work_queue: add WorkItemSingleShot
To run a specific method on a work queue and wait for it to return.
This commit is contained in:
@@ -50,6 +50,17 @@ WorkItem::WorkItem(const char *name, const wq_config_t &config) :
|
||||
}
|
||||
}
|
||||
|
||||
WorkItem::WorkItem(const char *name, const WorkItem &work_item) :
|
||||
_item_name(name)
|
||||
{
|
||||
px4::WorkQueue *wq = work_item._wq;
|
||||
|
||||
if ((wq != nullptr) && wq->Attach(this)) {
|
||||
_wq = wq;
|
||||
_start_time = hrt_absolute_time();
|
||||
}
|
||||
}
|
||||
|
||||
WorkItem::~WorkItem()
|
||||
{
|
||||
Deinit();
|
||||
|
||||
Reference in New Issue
Block a user