Fix the iomux_add/clear events. Also properly remember
the events in the IOMuxFD
This commit is contained in:
+15
-11
@@ -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);
|
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_)\
|
static inline int iomux_clear_event(struct IOMux *mux, struct IOMuxFD *fd,
|
||||||
({\
|
unsigned int what)
|
||||||
(fd)->what &= ~(what_);\
|
{
|
||||||
iomux_update_events((mux), (fd), (fd)->what & ~(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_)\
|
|
||||||
({\
|
static inline int iomux_add_event(struct IOMux *mux, struct IOMuxFD *fd,
|
||||||
iomux_update_events((mux), (fd), (fd)->what | (what_));\
|
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.
|
/** @return a UCTimer instance tied to this mux.
|
||||||
* Used to schedule timers within this mux.
|
* Used to schedule timers within this mux.
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ int iomux_update_events(struct IOMux *mux, struct IOMuxFD *fd, unsigned int what
|
|||||||
|
|
||||||
if (fd->what != what) {
|
if (fd->what != what) {
|
||||||
rc = mux->ops.update_events_impl(mux, fd);
|
rc = mux->ops.update_events_impl(mux, fd);
|
||||||
|
fd->what = what;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
Reference in New Issue
Block a user