Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
caa2611a
Commit
caa2611a
authored
Oct 15, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/SocketEvent: add Abandon()
parent
f8ff5979
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
SocketEvent.cxx
src/event/SocketEvent.cxx
+9
-0
SocketEvent.hxx
src/event/SocketEvent.hxx
+12
-0
No files found.
src/event/SocketEvent.cxx
View file @
caa2611a
...
...
@@ -86,6 +86,15 @@ SocketEvent::Schedule(unsigned flags) noexcept
}
void
SocketEvent
::
Abandon
()
noexcept
{
if
(
std
::
exchange
(
scheduled_flags
,
0
)
!=
0
)
loop
.
AbandonFD
(
fd
.
Get
());
fd
=
SocketDescriptor
::
Undefined
();
}
void
SocketEvent
::
Dispatch
()
noexcept
{
const
unsigned
flags
=
std
::
exchange
(
ready_flags
,
0
)
&
...
...
src/event/SocketEvent.hxx
View file @
caa2611a
...
...
@@ -121,6 +121,18 @@ public:
*/
void
Close
()
noexcept
;
/**
* Call this instead of Cancel() to unregister this object
* after the underlying socket has already been closed. This
* skips the `EPOLL_CTL_DEL` call because the kernel
* automatically removes closed file descriptors from epoll.
*
* Doing `EPOLL_CTL_DEL` on a closed file descriptor usually
* fails with `-EBADF` or could unregister a different socket
* which happens to be on the same file descriptor number.
*/
void
Abandon
()
noexcept
;
unsigned
GetScheduledFlags
()
const
noexcept
{
return
scheduled_flags
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment