Use nonblocking pipes
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include "ucore/iomux_waker.h"
|
||||
#include "ucore/fd_utils.h"
|
||||
|
||||
static void uc_waker_pipe_cb(struct IOMux *mux, struct IOMuxFD *fd, unsigned int event)
|
||||
{
|
||||
@@ -64,6 +65,10 @@ int uc_iomux_waker_init(struct IOMux *mux, struct IOMuxWaker *wk, uc_waker_cb cb
|
||||
wk->mux = mux;
|
||||
wk->wake_cb = cb;
|
||||
wk->signaller.fd = pfds[1];
|
||||
rc = uc_set_nonblocking(pfds[0]);
|
||||
assert(rc == 0);
|
||||
rc = uc_set_nonblocking(pfds[1]);
|
||||
assert(rc == 0);
|
||||
|
||||
if (uc_install_wake_handler(wk, pfds[0]) == 0) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user