event.h (2022-02-24 14:07:56 -0500, (build 8c2561559))
Go to the documentation of this file.
1/*******************************************************
2 * Copyright (c) 2019, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10#pragma once
11
12#include <af/defines.h>
13
14#if AF_API_VERSION >= 37
15
21typedef void* af_event;
22
23#ifdef __cplusplus
24namespace af {
25
31class AFAPI event {
32 af_event e_;
33
34 public:
37#if AF_COMPILER_CXX_RVALUE_REFERENCES
39 event(event&& other);
40
42 event& operator=(event&& other);
43#endif
46
49
51 af_event get() const;
52
55 void mark();
56
58 void enqueue();
59
61 void block() const;
62
63 private:
64 event& operator=(const event& other);
65 event(const event& other);
66};
67
68} // namespace af
69#endif
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
83
92
104
115
125
126#ifdef __cplusplus
127}
128#endif // __cplusplus
129
130#endif // AF_API_VERSION >= 37
C++ RAII interface for manipulating events.
Definition: event.h:31
void block() const
block the calling thread until this event has occurred
void enqueue()
Block the ArrayFire queue until this even has occurred.
~event()
event Destructor
event(af_event e)
Create a new event using the C af_event handle.
void mark()
Adds the event on the default ArrayFire queue.
event()
Create a new event object.
af_event get() const
Return the underlying C af_event handle.
af_err
Definition: defines.h:71
#define AFAPI
Definition: defines.h:38
AFAPI af_err af_block_event(const af_event eventHandle)
blocks the calling thread on events until all events on the computation stream before mark was called...
AFAPI af_err af_delete_event(af_event eventHandle)
Release the af_event handle.
AFAPI af_err af_mark_event(const af_event eventHandle)
marks the af_event on the active computation stream.
AFAPI af_err af_enqueue_wait_event(const af_event eventHandle)
enqueues the af_event and all enqueued events on the active stream.
void * af_event
Handle to an event object.
Definition: event.h:21
AFAPI af_err af_create_event(af_event *eventHandle)
Create a new af_event handle.
Definition: algorithm.h:15