-
Notifications
You must be signed in to change notification settings - Fork 2
/
sbfEvent.h
63 lines (53 loc) · 1.9 KB
/
sbfEvent.h
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
/*!
\file sbfEvent.h
\brief This file declares the event structures and functions for event
handling.
\Copyright 2014-2018 Neueda Ltd.
*/
#ifndef _SBF_EVENT_H_
#define _SBF_EVENT_H_
#include "sbfCommon.h"
SBF_BEGIN_DECLS
//------------------------------------------------------------------------------
// Forward declarations
//------------------------------------------------------------------------------
struct sbfMwThreadImpl;
struct sbfQueueImpl;
/** \brief public event structure */
typedef struct sbfEventImpl* sbfEvent;
/** \brief Event indicating a read operation */
#define SBF_EVENT_READ 0x2
/** \brief Event indicating a write operation */
#define SBF_EVENT_WRITE 0x4
/*!
\brief Callback function indicating there are events to process.
\param event Pointer to events objects.
\param the number of events.
\param closure the data associated to the callback.
*/
typedef void (*sbfEventCb) (sbfEvent event, int events, void* closure);
/* . */
/*!
\brief Returns an event handler with the provided information.
Events is one or both of SBF_EVENT_READ and SBF_EVENT_WRITE.
\param thread the thread handling the reception of events.
\param queue queue where events are stored.
\param cb the event's callback.
\param closure a data to be associated to the event to be used in callbacks.
\param descriptor the descriptor.
\param events the number of events.
\return an event handler with the provided information.
*/
sbfEvent sbfEvent_create (struct sbfMwThreadImpl* thread,
struct sbfQueueImpl* queue,
sbfEventCb cb,
void* closure,
int descriptor,
int events);
/*!
\brief Releases the memory allocated by the given memory handler.
\param event the event handler.
*/
void sbfEvent_destroy (sbfEvent event);
SBF_END_DECLS
#endif /* _SBF_EVENT_H_ */