Since the same FD may be added multiple times (e.g. with separate
callbacks for WATCHER_READ and WATCHER_WRITE), the previous check
might not have found the correct entry. As the entry can't be removed
while in a callback, the pointer comparison is fine.
* Data we pass on for an async notification
*/
typedef struct {
+ /** triggering entry */
+ entry_t *entry;
/** file descriptor */
int fd;
/** event type */
this->mutex->lock(this->mutex);
for (entry = this->fds; entry; prev = entry, entry = entry->next)
{
- if (entry->fd == data->fd)
+ if (entry == data->entry)
{
if (!data->keep)
{
/* get a copy of entry for async job, but with specific event */
INIT(data,
+ .entry = entry,
.fd = entry->fd,
.event = event,
.cb = entry->cb,