kupl_event_wait
Block until all kernels prior to the specified event have completed execution.
Interface Definition
int kupl_event_wait(kupl_event_h event);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
event |
kupl_event_h |
Event 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 25 26 27 28 | #include <stdio.h> #include <assert.h> #include "kupl.h" static inline void kernel_func(void *args) { printf("kernel exec.\n"); } int main() { kupl_event_h event = kupl_event_create(); kupl_queue_h queue = kupl_queue_create(); kupl_queue_item_desc_t desc = { .func = kernel_func, .args = NULL, .name = "kernel_name" }; kupl_queue_submit(queue, &desc); kupl_event_record(event, queue); int ret = kupl_event_wait(event); assert(ret == KUPL_OK); kupl_queue_destroy(queue); kupl_event_destroy(event); return 0; } |
The execution result is as follows:
kernel exec.
The preceding example demonstrates the process of submitting a kernel to the queue and waiting until the kernel is executed. The kupl_event_wait function in the preceding example continues to execute only after all kernels before the event are executed.
Parent topic: Multi-queue Multi-stream Programming Functions