Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early close file descriptors #94

Closed
wants to merge 2 commits into from
Closed

Early close file descriptors #94

wants to merge 2 commits into from

Conversation

ymmt2005
Copy link
Member

@ymmt2005 ymmt2005 commented Aug 5, 2024

Resolves #93.

cybozu::resource now keeps the file descriptor private and adds
a new private method close() to close the file descriptor from
the friend class cybozu::reactor. Subclasses can get the file
descriptor via int fileno() method that returns -1 after the
resource is invalidated.

cybozu::reactor calls cybozu::resource::close when it removes
the resource from the active set of resources and puts it to the
pending destruction list. By this, the file descriptor of the
invalidated resource is closed earlier.

Other classes are updated to reference fileno().

@ymmt2005 ymmt2005 self-assigned this Aug 5, 2024
@ymmt2005 ymmt2005 marked this pull request as ready for review August 5, 2024 07:13
@ymmt2005 ymmt2005 requested a review from nojima August 5, 2024 07:13
@ymmt2005 ymmt2005 marked this pull request as draft August 5, 2024 07:22
Resolves #93.

`cybozu::resource` now keeps the file descriptor private and adds
a new private method `close()` to close the file descriptor from
the friend class `cybozu::reactor`. Subclasses can get the file
descriptor via `int fileno()` method that returns -1 after closed.

`cybozu::reactor` calls `cybozu::resource::close` when it removes
the resource from the active set of resources and puts it to the
pending destruction list. By this, the file descriptor of the
closed resource is closed earlier.

Other classes are updated to reference `fileno()`.
@ymmt2005
Copy link
Member Author

replaced by #95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Close socket file descriptors earlier
1 participant