@@ -154,7 +154,7 @@ struct PalEvent {
154154 PalEventType type ;
155155 Int64 data ; /** < First data payload.*/
156156 Int64 data2 ; /** < Second data payload.*/
157- Int64 userId ; /** You can have user events upto Int64 max.*/
157+ Int64 userId ; /** < You can have user events upto Int64 max.*/
158158};
159159
160160/**
@@ -192,81 +192,78 @@ typedef struct {
192192 * @brief Create an event driver.
193193 *
194194 * The allocator field in the provided PalEventDriverCreateInfo struct will not
195- * be copied, so the pointer must remain valid until the event driver is
195+ * be copied, therefore pointer must remain valid until the event driver is
196196 * destroyed. Destroy the event driver with palDestroyEventDriver() when no
197197 * longer needed.
198198 *
199199 * @param[in] info Pointer to a PalEventDriverCreateInfo struct that specifies
200- * paramters.
200+ * paramters. Must not be nullptr.
201201 * @param[out] outEventDriver Pointer to a PalEventDriver to recieve the created
202- * event driver.
202+ * event driver. Must not be nullptr.
203203 *
204204 * @return PAL_RESULT_SUCCESS on success or a result code on
205205 * failure. Call palFormatResult() for more information.
206206 *
207- * @note This function may be called from any thread, but not concurrently.
208- * Users must ensure synchronization.
209- *
210- * @sa PalEventDriverCreateInfo
211- * @sa palDestroyEventDriver()
207+ * Thread safety: This function is thread safe if the provided allocator is
208+ * thread safe and `outEventDriver` is thread local. The default allocator is
209+ * thread safe.
212210 *
213211 * @since 1.0
214212 * @ingroup pal_event
213+ * @sa palDestroyEventDriver
215214 */
216215PAL_API PalResult PAL_CALL palCreateEventDriver (
217216 const PalEventDriverCreateInfo * info ,
218217 PalEventDriver * * outEventDriver );
219218
220219/**
221- * @brief Destroy the event driver.
220+ * @brief Destroy the provided event driver.
222221 *
223222 * This function can be called multiple times without any undefined behavior.
224223 * If the event driver is invalid or nullptr, this function returns silently.
225224 *
226225 * @param[in] eventDriver Pointer to the event driver to destroy.
227226 *
228- * @note This function may be called from any thread, but not concurrently.
229- * Users must ensure synchronization.
230- *
231- * @sa palCreateEventDriver()
227+ * Thread safety: This function is thread safe if the allocator used to create
228+ * the event driver is thread safe and `eventDriver` is thread local.
232229 *
233230 * @since 1.0
234231 * @ingroup pal_event
232+ * @sa palCreateEventDriver
235233 */
236234PAL_API void PAL_CALL palDestroyEventDriver (PalEventDriver * eventDriver );
237235
238236/**
239- * @brief Set the dispatch mode for an event type for the provided event driver.
237+ * @brief Set the dispatch mode for an event type with the provided event
238+ * driver.
240239 *
241240 * If the event driver is not valid, the function fails and the dispatch mode
242241 * will not be set.
243242 *
244- * If the dispatch mode is PAL_DISPATCH_POLL, the event will be dispatched to
245- * the event queue. If the dispatch mode is PAL_DISPATCH_CALLBACK and the
246- * event driver has a valid callback, the event will be dispatched to the event
247- * callback. If not the event will be discared .
243+ * If the dispatch mode is PAL_DISPATCH_POLL, the event will be dispatched into
244+ * the event drivers event queue. If the dispatch mode is PAL_DISPATCH_CALLBACK
245+ * and the event driver has a valid callback, the event will be dispatched to
246+ * the event drivers callback otherwise the event will be discarded .
248247 *
249248 * @param[in] eventDriver Pointer to the event driver.
250249 * @param[in] type Event type to set dispatch mode for.
251- * @param[in] mode Dispatch mode to use. See PalDispatchMode.
250+ * @param[in] mode Dispatch mode to use.
252251 *
253- * @note This function may be called from any thread, but not concurrently.
254- * Users must ensure synchronization.
255- *
256- * @sa palCreateEventDriver()
257- * @sa PalDispatchMode
258- * @sa PalEventType
252+ * Thread safety: This function is thread if multiple threads are not
253+ * simultaneously setting dispatch mode on the same `eventDriver`.
259254 *
260255 * @since 1.0
261256 * @ingroup pal_event
257+ * @sa palGetEventDispatchMode
262258 */
263259PAL_API void PAL_CALL palSetEventDispatchMode (
264260 PalEventDriver * eventDriver ,
265261 PalEventType type ,
266262 PalDispatchMode mode );
267263
268264/**
269- * @brief Get the dispatch mode for an event type for the provided event driver.
265+ * @brief Get the dispatch mode for an event type with the provided event
266+ * driver.
270267 *
271268 * If the event driver is not valid, the function fails and returns
272269 * PAL_DISPATCH_NONE.
@@ -276,44 +273,39 @@ PAL_API void PAL_CALL palSetEventDispatchMode(
276273 *
277274 * @return The dispatch mode on success or PAL_DISPATCH_NONE on failure.
278275 *
279- * @note This function is thread-safe and may be called from any thread.
280- *
281- * @sa palCreateEventDriver()
282- * @sa PalDispatchMode
283- * @sa PalEventType
276+ * Thread safety: This function is thread if multiple threads are not
277+ * simultaneously setting dispatch mode on the same `eventDriver`.
284278 *
285279 * @since 1.0
286280 * @ingroup pal_event
281+ * @sa palSetEventDispatchMode
287282 */
288283PAL_API PalDispatchMode PAL_CALL palGetEventDispatchMode (
289284 PalEventDriver * eventDriver ,
290285 PalEventType type );
291286
292287/**
293- * @brief Push an event onto the queue of the provided event driver.
288+ * @brief Push an event into the queue or callback of the provided event driver.
294289 *
295290 * If the event driver is not valid, the function fails and the event will not
296291 * be pushed.
297292 * If the dispatch mode for the event is PAL_DISPATCH_POLL, the event will be
298293 * pushed to the event queue.
299294 *
300295 * If dispatch mode is PAL_DISPATCH_CALLBACK and the event driver has a valid
301- * event callback, the callback will be called. If not the event will be
302- * discared .
296+ * event callback, the callback will be called otherwise the event will be
297+ * discarded .
303298 *
304299 * @param[in] eventDriver Pointer to the event driver.
305- * @param[in] event Pointer to thes event. This must be valid and should be
306- * initialized explicitly.
307- *
308- * @note This function may be called from any thread, but not concurrently.
309- * Users must ensure synchronization.
300+ * @param[in] event Pointer to the event to push.
310301 *
311- * @sa palCreateEventDriver()
312- * @sa PalDispatchMode
313- * @sa PalEvent
302+ * Thread safety: This function is thread if the provided event queue is thread
303+ * safe or every thread has its own `eventDriver`. The default event queue is
304+ * not thread safe.
314305 *
315306 * @since 1.0
316307 * @ingroup pal_event
308+ * @sa palPollEvent
317309 */
318310PAL_API void PAL_CALL palPushEvent (
319311 PalEventDriver * eventDriver ,
@@ -332,15 +324,14 @@ PAL_API void PAL_CALL palPushEvent(
332324 * @param[in] eventDriver Pointer to the event driver.
333325 * @param[out] outEvent Pointer to a PalEvent to recieve the event. Must be
334326 * valid.
335- *
336- * @note This function may be called from any thread, but not concurrently.
337- * Users must ensure synchronization.
338- *
339- * @sa palCreateEventDriver()
340- * @sa PalEvent
327+ *
328+ * Thread safety: This function is thread if the provided event queue is thread
329+ * safe or every thread has its own `eventDriver`. The default event queue is
330+ * not thread safe.
341331 *
342332 * @since 1.0
343333 * @ingroup pal_event
334+ * @sa palPushEvent
344335 */
345336PAL_API bool PAL_CALL palPollEvent (
346337 PalEventDriver * eventDriver ,
0 commit comments