Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add iterator

git-svn-id: http://svn.coderepos.org/share/lang/c/picoev/trunk@35043 d0d07461-0603-4401-acd4-de1884942a52
  • Loading branch information...
commit 9480be784a69cc758b6668cee6ee7bdc703445ca 1 parent bb3b5ba
kazuho authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 picoev.h
View
13 picoev.h
@@ -275,6 +275,19 @@ extern "C" {
return 0;
}
+ /* function to iterate registered information. To start iteration, set curfd
+ to -1 and call the function until -1 is returned */
+ PICOEV_INLINE
+ int picoev_next_fd(picoev_loop* loop, int curfd) {
+ assert(PICOEV_IS_INITED_AND_FD_IN_RANGE(curfd));
+ while (++curfd < picoev.max_fd) {
+ if (loop->loop_id == picoev.fds[curfd].loop_id) {
+ return curfd;
+ }
+ }
+ return -1;
+ }
+
/* internal function */
PICOEV_INLINE
int picoev_init_loop_internal(picoev_loop* loop, int max_timeout) {
Please sign in to comment.
Something went wrong with that request. Please try again.