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
154bdf0b
Commit
154bdf0b
authored
Nov 06, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/SocketMonitor: add method Abandon()
parent
ed436c6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
2 deletions
+32
-2
Loop.cxx
src/event/Loop.cxx
+7
-2
Loop.hxx
src/event/Loop.hxx
+7
-0
SocketMonitor.cxx
src/event/SocketMonitor.cxx
+13
-0
SocketMonitor.hxx
src/event/SocketMonitor.hxx
+5
-0
No files found.
src/event/Loop.cxx
View file @
154bdf0b
...
...
@@ -58,13 +58,18 @@ EventLoop::Break()
AddCall
([
this
]()
{
Break
();
});
}
bool
EventLoop
::
RemoveFD
(
int
_fd
,
SocketMonitor
&
m
)
void
EventLoop
::
Abandon
(
SocketMonitor
&
m
)
{
for
(
unsigned
i
=
0
,
n
=
n_events
;
i
<
n
;
++
i
)
if
(
events
[
i
].
data
.
ptr
==
&
m
)
events
[
i
].
events
=
0
;
}
bool
EventLoop
::
RemoveFD
(
int
_fd
,
SocketMonitor
&
m
)
{
Abandon
(
m
);
return
epoll
.
Remove
(
_fd
);
}
...
...
src/event/Loop.hxx
View file @
154bdf0b
...
...
@@ -121,6 +121,13 @@ public:
return
epoll
.
Modify
(
_fd
,
flags
,
&
m
);
}
/**
* Remove the given #SocketMonitor after the file descriptor
* has been closed. This is like RemoveFD(), but does not
* attempt to use #EPOLL_CTL_DEL.
*/
void
Abandon
(
SocketMonitor
&
m
);
bool
RemoveFD
(
int
fd
,
SocketMonitor
&
m
);
void
AddIdle
(
IdleMonitor
&
i
);
...
...
src/event/SocketMonitor.cxx
View file @
154bdf0b
...
...
@@ -152,6 +152,19 @@ SocketMonitor::Steal()
}
void
SocketMonitor
::
Abandon
()
{
assert
(
IsDefined
());
#ifdef USE_EPOLL
fd
=
-
1
;
loop
.
Abandon
(
*
this
);
#else
Steal
();
#endif
}
void
SocketMonitor
::
Close
()
{
close_socket
(
Steal
());
...
...
src/event/SocketMonitor.hxx
View file @
154bdf0b
...
...
@@ -118,6 +118,11 @@ public:
*/
int
Steal
();
/**
* Somebody has closed the socket. Unregister this object.
*/
void
Abandon
();
void
Close
();
unsigned
GetScheduledFlags
()
const
{
...
...
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