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
732bdc80
Commit
732bdc80
authored
Dec 18, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/SocketMonitor: Schedule() returns bool
parent
a8661b59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
SocketMonitor.cxx
src/event/SocketMonitor.cxx
+10
-6
SocketMonitor.hxx
src/event/SocketMonitor.hxx
+9
-5
No files found.
src/event/SocketMonitor.cxx
View file @
732bdc80
...
...
@@ -68,20 +68,24 @@ SocketMonitor::Close() noexcept
Steal
().
Close
();
}
void
bool
SocketMonitor
::
Schedule
(
unsigned
flags
)
noexcept
{
assert
(
IsDefined
());
if
(
flags
==
GetScheduledFlags
())
return
;
return
true
;
bool
success
;
if
(
scheduled_flags
==
0
)
loop
.
AddFD
(
fd
.
Get
(),
flags
,
*
this
);
success
=
loop
.
AddFD
(
fd
.
Get
(),
flags
,
*
this
);
else
if
(
flags
==
0
)
loop
.
RemoveFD
(
fd
.
Get
(),
*
this
);
success
=
loop
.
RemoveFD
(
fd
.
Get
(),
*
this
);
else
loop
.
ModifyFD
(
fd
.
Get
(),
flags
,
*
this
);
success
=
loop
.
ModifyFD
(
fd
.
Get
(),
flags
,
*
this
);
if
(
success
)
scheduled_flags
=
flags
;
scheduled_flags
=
flag
s
;
return
succes
s
;
}
src/event/SocketMonitor.hxx
View file @
732bdc80
...
...
@@ -98,18 +98,22 @@ public:
return
scheduled_flags
;
}
void
Schedule
(
unsigned
flags
)
noexcept
;
/**
* @return true on success, false on error (with errno set if
* USE_EPOLL is defined)
*/
bool
Schedule
(
unsigned
flags
)
noexcept
;
void
Cancel
()
noexcept
{
Schedule
(
0
);
}
void
ScheduleRead
()
noexcept
{
Schedule
(
GetScheduledFlags
()
|
READ
|
HANGUP
|
ERROR
);
bool
ScheduleRead
()
noexcept
{
return
Schedule
(
GetScheduledFlags
()
|
READ
|
HANGUP
|
ERROR
);
}
void
ScheduleWrite
()
noexcept
{
Schedule
(
GetScheduledFlags
()
|
WRITE
);
bool
ScheduleWrite
()
noexcept
{
return
Schedule
(
GetScheduledFlags
()
|
WRITE
);
}
void
CancelRead
()
noexcept
{
...
...
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