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
9e97acc2
Commit
9e97acc2
authored
Oct 30, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/WinSelect: merge duplicate code into ApplyReady()
parent
b1e446a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
WinSelectBackend.cxx
src/event/WinSelectBackend.cxx
+11
-8
WinSelectBackend.hxx
src/event/WinSelectBackend.hxx
+2
-0
No files found.
src/event/WinSelectBackend.cxx
View file @
9e97acc2
...
...
@@ -117,6 +117,14 @@ WinSelectBackend::Remove(SOCKET fd) noexcept
return
true
;
}
void
WinSelectBackend
::
ApplyReady
(
const
SocketSet
&
src
,
unsigned
events
)
noexcept
{
for
(
const
auto
i
:
src
)
{
items
[
i
].
events
|=
events
;
}
}
PollResultGeneric
WinSelectBackend
::
ReadEvents
(
int
timeout_ms
)
noexcept
{
...
...
@@ -148,14 +156,9 @@ WinSelectBackend::ReadEvents(int timeout_ms) noexcept
if
(
ret
==
0
||
ret
==
SOCKET_ERROR
)
return
result
;
for
(
const
auto
i
:
read_set
)
items
[
i
].
events
|=
WinSelectEvents
::
READ
;
for
(
const
auto
i
:
write_set
)
items
[
i
].
events
|=
WinSelectEvents
::
WRITE
;
for
(
const
auto
i
:
except_set
)
items
[
i
].
events
|=
WinSelectEvents
::
WRITE
;
ApplyReady
(
read_set
,
WinSelectEvents
::
READ
);
ApplyReady
(
write_set
,
WinSelectEvents
::
WRITE
);
ApplyReady
(
except_set
,
WinSelectEvents
::
WRITE
);
for
(
auto
&
i
:
items
)
if
(
i
.
second
.
events
!=
0
)
{
...
...
src/event/WinSelectBackend.hxx
View file @
9e97acc2
...
...
@@ -119,6 +119,8 @@ private:
int
event_id
)
const
noexcept
;
void
Modify
(
Item
&
item
,
SOCKET
fd
,
unsigned
events
,
int
event_id
)
noexcept
;
void
ApplyReady
(
const
SocketSet
&
src
,
unsigned
events
)
noexcept
;
};
#endif
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