Implement generalied IOMux implementation operations

Fix serious bug  in iomix_timers_run
This commit is contained in:
Nils O. Selåsdal
2014-03-02 06:00:05 +01:00
parent 857c2018b9
commit a112b44c6e
4 changed files with 52 additions and 36 deletions
+21 -15
View File
@@ -4,21 +4,7 @@
#include "ucore/iomux.h"
#include "ucore/timers.h"
/** struct for IOMux implementations */
struct IOMux {
/* TImer instance */
struct UCTimers timers;
/**
* Clock used for driving timers, and
* providing timeouts for the mux
*/
struct UCoreClock *uclock;
/* Used by mux implementations to hold their own data/instance */
void *instance;
struct IOMuxOps {
/** Run one iteration of the mux.
* The mux implementation must honor the timeout, if given.
* The mux implementation must call iomux_timers_run after the
@@ -39,6 +25,26 @@ struct IOMux {
int (*unregister_fd_impl)(struct IOMux *mux, struct IOMuxFD *fd);
/** Update an IOMuxFD (due to its events ('what') has changed*/
int (*update_events_impl)(struct IOMux *mux, struct IOMuxFD *fd);
};
struct IOMux {
/* TImer instance */
struct UCTimers timers;
/**
* Clock used for driving timers, and
* providing timeouts for the mux
*/
struct UCoreClock *uclock;
struct IOMuxOps ops;
/* Used by mux implementations to hold their own data/instance */
void *instance;
};
int iomux_select_init(struct IOMux *mux);