Skip to content

Now use epoll so we can wake up readEvents#66

Closed
PieterD wants to merge 15 commits intofsnotify:masterfrom
PieterD:inotify-epoll
Closed

Now use epoll so we can wake up readEvents#66
PieterD wants to merge 15 commits intofsnotify:masterfrom
PieterD:inotify-epoll

Conversation

@PieterD
Copy link
Copy Markdown
Contributor

@PieterD PieterD commented Feb 7, 2015

fixes #5.
fixes #40.
updates #59 (fixed for inotify).

@nathany
Copy link
Copy Markdown
Contributor

nathany commented Feb 7, 2015

I like how you separated the poller out into a separate file. But man, this makes it so much more complex.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think InotifyInit should remain in NewWatcher and pass the fd into newFdPoller.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, NewWatcher should be responsible for closing the inotify fd if poller has an error.

Poller could in theory work for any fd passed in and only clean up its own resources.

@nathany
Copy link
Copy Markdown
Contributor

nathany commented Feb 7, 2015

Should there be inotify_poller_test.go?

@nathany nathany added the linux label Feb 7, 2015
inotify.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe doneResp instead? Or doneResposne?

I was thinking of sending a signal one way over the done channel and then sending one back, but that won't work if the first signal is to close. Looking at the code more closely, I think we need to keep the two separate channels.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm starting to wonder if we should have a helper function to send an error down the channel or err/abort if done.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then read form inotify

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for the _

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Mixing named and unamed. Mind you errno isn't really needed here for readability of the API. Could move it to var.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is required to reference the return value in the deferred function two lines below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot remove watch for deleted file inotify blocks

2 participants