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
e9d764d7
Commit
e9d764d7
authored
Jan 05, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/Loop: add attribute "again"
Improved support for added events.
parent
62689557
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
Loop.cxx
src/event/Loop.cxx
+4
-2
Loop.hxx
src/event/Loop.hxx
+6
-0
No files found.
src/event/Loop.cxx
View file @
e9d764d7
...
@@ -79,6 +79,7 @@ EventLoop::AddIdle(IdleMonitor &i)
...
@@ -79,6 +79,7 @@ EventLoop::AddIdle(IdleMonitor &i)
assert
(
std
::
find
(
idle
.
begin
(),
idle
.
end
(),
&
i
)
==
idle
.
end
());
assert
(
std
::
find
(
idle
.
begin
(),
idle
.
end
(),
&
i
)
==
idle
.
end
());
idle
.
push_back
(
&
i
);
idle
.
push_back
(
&
i
);
again
=
true
;
}
}
void
void
...
@@ -98,6 +99,7 @@ EventLoop::AddTimer(TimeoutMonitor &t, unsigned ms)
...
@@ -98,6 +99,7 @@ EventLoop::AddTimer(TimeoutMonitor &t, unsigned ms)
assert
(
IsInside
());
assert
(
IsInside
());
timers
.
insert
(
TimerRecord
(
t
,
now_ms
+
ms
));
timers
.
insert
(
TimerRecord
(
t
,
now_ms
+
ms
));
again
=
true
;
}
}
void
void
...
@@ -123,6 +125,7 @@ EventLoop::Run()
...
@@ -123,6 +125,7 @@ EventLoop::Run()
do
{
do
{
now_ms
=
::
MonotonicClockMS
();
now_ms
=
::
MonotonicClockMS
();
again
=
false
;
/* invoke timers */
/* invoke timers */
...
@@ -149,7 +152,6 @@ EventLoop::Run()
...
@@ -149,7 +152,6 @@ EventLoop::Run()
/* invoke idle */
/* invoke idle */
const
bool
idle_empty
=
idle
.
empty
();
while
(
!
idle
.
empty
())
{
while
(
!
idle
.
empty
())
{
IdleMonitor
&
m
=
*
idle
.
front
();
IdleMonitor
&
m
=
*
idle
.
front
();
idle
.
pop_front
();
idle
.
pop_front
();
...
@@ -159,7 +161,7 @@ EventLoop::Run()
...
@@ -159,7 +161,7 @@ EventLoop::Run()
return
;
return
;
}
}
if
(
!
idle_empty
)
if
(
again
)
/* re-evaluate timers because one of the
/* re-evaluate timers because one of the
IdleMonitors may have added a new
IdleMonitors may have added a new
timeout */
timeout */
...
...
src/event/Loop.hxx
View file @
e9d764d7
...
@@ -84,6 +84,12 @@ class EventLoop final : SocketMonitor
...
@@ -84,6 +84,12 @@ class EventLoop final : SocketMonitor
bool
quit
;
bool
quit
;
/**
* True when the object has been modified and another check is
* necessary before going to sleep via PollGroup::ReadEvents().
*/
bool
again
;
PollGroup
poll_group
;
PollGroup
poll_group
;
PollResult
poll_result
;
PollResult
poll_result
;
...
...
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