Add is_watching method

This commit is contained in:
Jeremy Lakeman 2013-12-05 16:29:13 +10:30
parent 68b8f94b01
commit 4c525ae281
2 changed files with 8 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);