Fix the iomux_add/clear events. Also properly remember

the events in the IOMuxFD
This commit is contained in:
Nils O. Selåsdal
2015-05-12 19:21:57 +02:00
parent 7dd159aa6a
commit 5ecd083e7f
2 changed files with 16 additions and 11 deletions
+15 -11
View File
@@ -112,20 +112,24 @@ int iomux_unregister_fd(struct IOMux *mux, struct IOMuxFD *fd);
int iomux_update_events(struct IOMux *mux, struct IOMuxFD *fd, unsigned int what);
/**
* Convenience macro for clearing the new event
* Convenience for clearing the new event
*/
#define iomux_clear_event(mux, fd, what_)\
({\
(fd)->what &= ~(what_);\
iomux_update_events((mux), (fd), (fd)->what & ~(what_));\
})
static inline int iomux_clear_event(struct IOMux *mux, struct IOMuxFD *fd,
unsigned int what)
{
unsigned int new_what = fd->what & ~what;
return iomux_update_events(mux, fd, new_what);
}
/**
* Convenience macro for adding the new event to the existing events
* Convenience for adding the new event to the existing events
*/
#define iomux_add_event(mux, fd, what_)\
({\
iomux_update_events((mux), (fd), (fd)->what | (what_));\
})
static inline int iomux_add_event(struct IOMux *mux, struct IOMuxFD *fd,
unsigned int what)
{
unsigned int new_what = fd->what | what;
return iomux_update_events(mux, fd, new_what);
}
/** @return a UCTimer instance tied to this mux.
* Used to schedule timers within this mux.