NVIDIA Holoscan SDK v3.0.0

Class WorkQueue

class WorkQueue

The WorkQueue class maintains a pool of threads which execute jobs added with the async() function.

Public Functions

explicit WorkQueue(uint32_t threads)

Construct a new work queue

Parameters

threads – number of worker threads

WorkQueue() = delete
~WorkQueue()

Destroy the work queue

template<class F, class ...Args>
auto inline async(F &&f, Args&&... args) -> std::shared_ptr<std::packaged_task<std::invoke_result_t<std::decay_t<F>, std::decay_t<Args>...>()>>

Enqueue a function to be executed asynchronously by a thread of the pool

Template Parameters
  • F – function type

  • Args – argument types

Parameters
  • f – function (can be any callable object)

  • args – function arguments

Returns

std::shared_pointer with std::packed_task

void stop()

Stop all threads.

Previous Class TrtInfer
Next Class InputContext
© Copyright 2022-2025, NVIDIA. Last updated on Mar 12, 2025.