Implement write queue for iomux

This commit is contained in:
Nils O. Selåsdal
2015-11-10 19:28:12 +01:00
parent 1535edd21a
commit e7720cb232
3 changed files with 218 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#ifndef UCORE_WQUEUE_H_
#define UCORE_WQUEUE_H_
#include "mbuf.h"
#include "iomux.h"
typedef int (*wqueue_write_cb)(struct IOMux *mux, struct IOMuxFD *fd, struct MBuf *mbuf);
typedef int (*wqueue_read_cb)(struct IOMux *mux, struct IOMuxFD *fd);
struct UCWQueue {
struct IOMuxFD fd;
struct TailQ queue;
struct IOMux *mux;
wqueue_read_cb read_cb;
wqueue_write_cb write_cb;
unsigned int queue_len;
};
void uc_wqueue_init(struct UCWQueue *wqueue, struct IOMux *mux);
int uc_wqueue_clear(struct UCWQueue *wqueue);
int uc_wqueue_enqueue(struct UCWQueue *wqueue, struct MBuf *mbuf);
#endif