Add uc_wqueue_flush() to immedately preform mbuf writes
This commit is contained in:
@@ -103,4 +103,21 @@ int uc_wqueue_clear(struct UCWQueue *wqueue);
|
|||||||
*/
|
*/
|
||||||
int uc_wqueue_enqueue(struct UCWQueue *wqueue, struct MBuf *mbuf);
|
int uc_wqueue_enqueue(struct UCWQueue *wqueue, struct MBuf *mbuf);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Immediately write mbufs.
|
||||||
|
* This invokes the wqueue write callback immediately, just as if an
|
||||||
|
* write event from the IOMux had happened.
|
||||||
|
*
|
||||||
|
* As for a normal write event, the entire queue might not be
|
||||||
|
* written, if the associated write callback detectes it cannot write
|
||||||
|
* more data.
|
||||||
|
*
|
||||||
|
* @param wqueue
|
||||||
|
*
|
||||||
|
* return 0 if no error occured, -1 if the write callback returned
|
||||||
|
* UC_WQ_ABORT
|
||||||
|
*/
|
||||||
|
int uc_wqueue_flush(struct UCWQueue *wqueue);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ static int uc_wqueue_handle_write(struct UCWQueue *wqueue)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void uc_wqueue_cb(struct IOMux *mux, struct IOMuxFD *fd, unsigned int what)
|
static void uc_wqueue_cb(struct IOMux *mux, struct IOMuxFD *fd, unsigned int what)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@@ -110,3 +112,12 @@ int uc_wqueue_enqueue(struct UCWQueue *wqueue, struct MBuf *mbuf)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uc_wqueue_flush(struct UCWQueue *wqueue)
|
||||||
|
{
|
||||||
|
if (uc_wqueue_handle_write(wqueue) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user