Allow wquque to use callback to free an mbuf - so

mbufs can be reused/pooled
This commit is contained in:
Nils O. Selåsdal
2016-12-07 20:58:39 +01:00
parent a6fe01978c
commit 43f3a3372e
2 changed files with 11 additions and 4 deletions
+8 -1
View File
@@ -67,6 +67,12 @@ typedef enum UC_WQ_RESULT (*wqueue_write_cb)(struct IOMux *mux,
typedef enum UC_WQ_RESULT (*wqueue_read_cb)(struct IOMux *mux,
struct UCWQueue *wqueue);
/**
* Callback to free a MBuf once it's fully written.
* @param the fd of the current wqueue
*/
typedef void (*wqueue_free_mbuf_cb)(struct MBuf *mbuf);
/**
* Represents a queue of data to write.
* UCWQueue replaces a raw IOMuxFD, and manages a queue
@@ -91,7 +97,8 @@ struct UCWQueue {
/** Users callback for write events
*/
wqueue_write_cb write_cb;
/** Function used to free an MBuf - default is uc_mbuf_free()*/
wqueue_free_mbuf_cb free_cb;
/** Current number of queued struct MBuf
*/
unsigned int queue_len;