Have iomux_update_events be a no-op if the events didn't change
This commit is contained in:
+5
-15
@@ -105,20 +105,11 @@ int iomux_register_fd(struct IOMux *mux, struct IOMuxFD *fd);
|
||||
*/
|
||||
int iomux_unregister_fd(struct IOMux *mux, struct IOMuxFD *fd);
|
||||
|
||||
/** Updates the events to watch for in fd->what
|
||||
/** Updates the events to watch for
|
||||
*
|
||||
* @return 0 on success, an errno value on error
|
||||
*/
|
||||
int iomux_update_events(struct IOMux *mux, struct IOMuxFD *fd);
|
||||
|
||||
|
||||
/**
|
||||
* Convenience macro for setting the new event
|
||||
*/
|
||||
#define iomux_set_event(mux, fd, what_)\
|
||||
({\
|
||||
(fd)->what = (what_);\
|
||||
iomux_update_events((mux), (fd));\
|
||||
})
|
||||
int iomux_update_events(struct IOMux *mux, struct IOMuxFD *fd, unsigned int what);
|
||||
|
||||
/**
|
||||
* Convenience macro for clearing the new event
|
||||
@@ -126,15 +117,14 @@ int iomux_update_events(struct IOMux *mux, struct IOMuxFD *fd);
|
||||
#define iomux_clear_event(mux, fd, what_)\
|
||||
({\
|
||||
(fd)->what &= ~(what_);\
|
||||
iomux_update_events((mux), (fd));\
|
||||
iomux_update_events((mux), (fd), (fd)->what & ~(what_));\
|
||||
})
|
||||
/**
|
||||
* Convenience macro for adding the new event to the existing events
|
||||
*/
|
||||
#define iomux_add_event(mux, fd, what_)\
|
||||
({\
|
||||
(fd)->what &= (what_);\
|
||||
iomux_update_events((mux), (fd));\
|
||||
iomux_update_events((mux), (fd), (fd)->what | (what_));\
|
||||
})
|
||||
|
||||
/** @return a UCTimer instance tied to this mux.
|
||||
|
||||
Reference in New Issue
Block a user