diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-17 20:27:26 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-17 20:27:26 +0000 |
commit | d4919d58ed21910c65c716ccb6a72f8a6d7db272 (patch) | |
tree | 20da5f483bee2f1b369987a1ffafc6ae328c47a7 /nuttx/fs | |
parent | 2a6cd214ffc212fa6313f4a436a044558135a5b0 (diff) | |
download | px4-nuttx-d4919d58ed21910c65c716ccb6a72f8a6d7db272.tar.gz px4-nuttx-d4919d58ed21910c65c716ccb6a72f8a6d7db272.tar.bz2 px4-nuttx-d4919d58ed21910c65c716ccb6a72f8a6d7db272.zip |
Initial integration of poll()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1266 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r-- | nuttx/fs/fs_poll.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/nuttx/fs/fs_poll.c b/nuttx/fs/fs_poll.c index a59cee5aa..f28e84e26 100644 --- a/nuttx/fs/fs_poll.c +++ b/nuttx/fs/fs_poll.c @@ -48,6 +48,7 @@ #include <nuttx/fs.h> #include <nuttx/sched.h> +#include <nuttx/clock.h> #include "fs_internal.h" @@ -195,6 +196,7 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count) /* Process each descriptor in the list */ + *count = 0; for (i = 0; i < nfds; i++) { /* Teardown the poll */ @@ -228,7 +230,7 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count) * ****************************************************************************/ -static void poll_timeout(int argc, uint32 isem) +static void poll_timeout(int argc, uint32 isem, ...) { /* Wake up the poller */ @@ -284,16 +286,19 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout) { if (timeout >= 0) { - /* Wait for the poll event with a timeout */ + /* Wait for the poll event with a timeout. Note that the + * millisecond timeout has to be converted to system clock + * ticks for wd_start + */ wdog = wd_create(); - wd_start(wdog, poll_timeout, 1, (uint32)&sem); + wd_start(wdog, MSEC2TICK(timeout), poll_timeout, 1, (uint32)&sem); poll_semtake(&sem); wd_delete(wdog); } else { - /* Wait for the poll event with not timeout */ + /* Wait for the poll event with no timeout */ poll_semtake(&sem); } |