kupl_queue_wait
Synchronize a KUPL queue and wait until all items or kernels in the queue are executed.
Interface Definition
int kupl_queue_wait(kupl_queue_h queue);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
queue |
kupl_queue_h |
Queue to be synchronized |
Input |
Return Value
Success: KUPL_OK
Failure: KUPL_ERROR
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <stdio.h> #include <assert.h> #include "kupl.h" static inline void kernel_func(void *args) { printf("kernel exec.\n"); } int main() { kupl_queue_h queue = kupl_queue_create(); kupl_queue_item_desc_t desc = { .field_mask = KUPL_QUEUE_ITEM_DESC_FIELD_NAME, .func = kernel_func, .args = NULL, .name = "kernel_name" }; kupl_queue_submit(queue, &desc); int ret = kupl_queue_wait(queue); assert(ret == KUPL_OK); kupl_queue_destroy(queue); return 0; } |
The execution result is as follows:
kernel exec.
The preceding example demonstrates the process of submitting items to a queue and waiting until all items in the queue are executed. The kupl_queue_wait function continues execution only after all items in the queue are executed.
Parent topic: Multi-queue Multi-stream Programming Functions