add io_canread and io_canwrite
parent
325a6176ca
commit
eb563422c8
@ -0,0 +1,17 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include "io_internal.h"
|
||||
|
||||
int64 io_canread() {
|
||||
io_entry* e;
|
||||
if (first_readable==-1) return -1;
|
||||
e=array_get(&io_fds,sizeof(io_entry),first_readable);
|
||||
if (e && e->canread) {
|
||||
int64 r=first_readable;
|
||||
first_readable=e->next_read;
|
||||
return r;
|
||||
}
|
||||
return -1;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include "io_internal.h"
|
||||
|
||||
int64 io_canwrite() {
|
||||
io_entry* e;
|
||||
if (first_writeable==-1) return -1;
|
||||
e=array_get(&io_fds,sizeof(io_entry),first_writeable);
|
||||
if (e && e->canwrite) {
|
||||
int64 r=first_writeable;
|
||||
first_writeable=e->next_write;
|
||||
return r;
|
||||
}
|
||||
return -1;
|
||||
}
|
Loading…
Reference in New Issue