diff options
author | David 'Digit' Turner <digit@android.com> | 2010-11-18 00:33:31 -0800 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2010-11-18 00:33:31 -0800 |
commit | a20ae2d2f20ccbb16b58e6e45955d4f97c4dbd50 (patch) | |
tree | ebfcf03154525d19357b25c8dea82c2b42fd0bad /iolooper-select.c | |
parent | f6cbbf529c7f4d3164243fc2cb9241978b954633 (diff) | |
parent | 7a17b608de24e3aaf7d5ca030bb80a74dcc3baf9 (diff) | |
download | external_qemu-a20ae2d2f20ccbb16b58e6e45955d4f97c4dbd50.zip external_qemu-a20ae2d2f20ccbb16b58e6e45955d4f97c4dbd50.tar.gz external_qemu-a20ae2d2f20ccbb16b58e6e45955d4f97c4dbd50.tar.bz2 |
Merge "Implementation of event loop abstraction."
Diffstat (limited to 'iolooper-select.c')
-rw-r--r-- | iolooper-select.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/iolooper-select.c b/iolooper-select.c index dbb18dd..dc5257c 100644 --- a/iolooper-select.c +++ b/iolooper-select.c @@ -57,6 +57,29 @@ iolooper_del_fd( IoLooper* iol, int fd ) iol->max_fd_valid = 0; } +void +iolooper_modify( IoLooper* iol, int fd, int oldflags, int newflags ) +{ + if (fd < 0) + return; + + int changed = oldflags ^ newflags; + + if ((changed & IOLOOPER_READ) != 0) { + if ((newflags & IOLOOPER_READ) != 0) + FD_SET(fd, iol->reads); + else + FD_CLR(fd, iol->reads); + } + if ((changed & IOLOOPER_WRITE) != 0) { + if ((newflags & IOLOOPER_WRITE) != 0) + FD_SET(fd, iol->writes); + else + FD_CLR(fd, iol->writes); + } +} + + static int iolooper_fd_count( IoLooper* iol ) { |