event.h
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 
21 typedef void* af_event;
22 
23 #ifdef __cplusplus
24 namespace af {
25 
31 class AFAPI event {
32  af_event e_;
33 
34  public:
36  event(af_event e);
37 #if AF_COMPILER_CXX_RVALUE_REFERENCES
38  event(event&& other);
40 
42  event& operator=(event&& other);
43 #endif
44  event();
46 
48  ~event();
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
72 extern "C" {
73 #endif
74 
82 AFAPI af_err af_create_event(af_event* eventHandle);
83 
92 
103 AFAPI af_err af_mark_event(const af_event eventHandle);
104 
114 AFAPI af_err af_enqueue_wait_event(const af_event eventHandle);
115 
124 AFAPI af_err af_block_event(const af_event eventHandle);
125 
126 #ifdef __cplusplus
127 }
128 #endif // __cplusplus
129 
130 #endif // AF_API_VERSION >= 37
af_delete_event
AFAPI af_err af_delete_event(af_event eventHandle)
Release the af_event handle.
AFAPI
#define AFAPI
Definition: defines.h:38
af
Definition: algorithm.h:14
af_event
void * af_event
Handle to an event object.
Definition: event.h:21
af_enqueue_wait_event
AFAPI af_err af_enqueue_wait_event(const af_event eventHandle)
enqueues the af_event and all enqueued events on the active stream.
af_create_event
AFAPI af_err af_create_event(af_event *eventHandle)
Create a new af_event handle.
af_block_event
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...
af_mark_event
AFAPI af_err af_mark_event(const af_event eventHandle)
marks the af_event on the active computation stream.
af::event
C++ RAII interface for manipulating events.
Definition: event.h:31
af_err
af_err
Definition: defines.h:71
defines.h