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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
/** @file async_fwd.h */
typedef struct ucs_async_context ucs_async_context_t;
/**
* @ingroup UCS_RESOURCE
*
* Async event callback.
*
* @param id Event id (timer or file descriptor).
* @param events The events that triggered the callback.
* @param arg User-defined argument.
*/
typedef void ;
/**
* @ingroup UCS_RESOURCE
*
* Register a file descriptor for monitoring (call handler upon events).
* Every fd can have only one handler.
*
* @param mode Thread or signal.
* @param event_fd File descriptor to set handler for.
* @param events Events to wait on (UCS_EVENT_SET_EVxxx bits).
* @param cb Callback function to execute.
* @param arg Argument to callback.
* @param async Async context to which events are delivered.
* If NULL, safety is up to the user.
*
* @return Error code as defined by @ref ucs_status_t.
*/
ucs_status_t ;
/**
* @ingroup UCS_RESOURCE
*
* Add timer handler.
*
* @param mode Thread or signal.
* @param interval Timer interval.
* @param cb Callback function to execute.
* @param arg Argument to callback.
* @param async Async context to which events are delivered.
* If NULL, safety is up to the user.
* @param timer_id_p Filled with timer id.
*
* @return Error code as defined by @ref ucs_status_t.
*/
ucs_status_t ;
/**
* @ingroup UCS_RESOURCE
*
* Remove an event handler (Timer or event file).
*
* @param id Timer/FD to remove.
* @param sync If nonzero, wait until the handler for this event is not
* running anymore. If called from the context of the callback,
* the handler will be removed immediately after the current
* callback returns.
*
* @return Error code as defined by @ref ucs_status_t.
*/
ucs_status_t ;
/**
* @ingroup UCS_RESOURCE
*
* Modify events mask for an existing event handler (event file).
*
* @param fd File descriptor modify events for.
* @param events New set of events to wait on (UCS_EVENT_SET_EVxxx bits).
*
* @return Error code as defined by @ref ucs_status_t.
*/
ucs_status_t ;
/**
* @ingroup UCS_RESOURCE
* @brief Create an asynchronous execution context
*
* Allocate and initialize an asynchronous execution context.
* This can be used to ensure safe event delivery.
*
* @param mode Indicates whether to use signals or polling threads
* for waiting.
* @param async_p Event context pointer to initialize.
*
* @return Error code as defined by @ref ucs_status_t.
*/
ucs_status_t ;
/**
* @ingroup UCS_RESOURCE
* @brief Destroy the asynchronous execution context
*
* Clean up the async context, and release system resources if possible.
* The context memory released.
*
* @param async Asynchronous context to clean up.
*/
void ;
/**
* @ingroup UCS_RESOURCE
*
* Poll on async context.
*
* @param async Async context to poll on. NULL polls on all.
*/
void ;
void ;