diff --git a/fdqueue.c b/fdqueue.c index c7f8abbb..03592167 100644 --- a/fdqueue.c +++ b/fdqueue.c @@ -195,6 +195,13 @@ int _watch(struct __sourceloc __whence, struct sched_ent *alarm) return 0; } +int is_watching(struct sched_ent *alarm) +{ + if (alarm->_poll_index <0 || fds[alarm->_poll_index].fd!=alarm->poll.fd) + return 0; + return 1; +} + // stop watching a file handle int _unwatch(struct __sourceloc __whence, struct sched_ent *alarm) { diff --git a/fdqueue.h b/fdqueue.h index 080b6cbc..9aab47b5 100644 --- a/fdqueue.h +++ b/fdqueue.h @@ -63,6 +63,7 @@ struct sched_ent{ }; int is_scheduled(const struct sched_ent *alarm); +int is_watching(struct sched_ent *alarm); int _schedule(struct __sourceloc, struct sched_ent *alarm); int _unschedule(struct __sourceloc, struct sched_ent *alarm); int _watch(struct __sourceloc, struct sched_ent *alarm);