Pass the wqueue directly to the wqueue callback functions

This commit is contained in:
Nils O. Selåsdal
2015-12-04 22:25:57 +01:00
parent 1d26348bb0
commit 94dcd522aa
3 changed files with 14 additions and 9 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ static int uc_wqueue_handle_write(struct UCWQueue *wqueue)
q = UC_TAILQ_FIRST(&wqueue->queue);
mbuf = UC_TAILQ_CONTAINER(q, struct MBuf, entry);
rc = wqueue->write_cb(mux, fd, mbuf);
rc = wqueue->write_cb(mux, wqueue, mbuf);
if (rc <= 0) {
//NOTE for rc < 0, nothing can touch the wqueue or fd
//any more, as it might been free'd
@@ -58,7 +58,7 @@ static void uc_wqueue_cb(struct IOMux *mux, struct IOMuxFD *fd, unsigned int wha
if (rc >= 0 && what & MUX_EV_READ) {
rc = wqueue->read_cb(mux, fd);
rc = wqueue->read_cb(mux, wqueue);
//NOTE - can't touch the wqueue or fd after this point,
//as it might been free'd
}