Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ReadMailReallyFast
code
Commits
68f85842
Commit
68f85842
authored
2 years ago
by
Benny Baumann
Browse files
Options
Downloads
Patches
Plain Diff
add: Allow to stop the event loop programmatically
parent
cfbce152
No related branches found
No related tags found
1 merge request
!1
First unit tests
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mumta/evloop.cpp
+18
-1
18 additions, 1 deletion
src/mumta/evloop.cpp
src/mumta/evloop.hpp
+1
-0
1 addition, 0 deletions
src/mumta/evloop.hpp
with
19 additions
and
1 deletion
src/mumta/evloop.cpp
+
18
−
1
View file @
68f85842
...
...
@@ -31,7 +31,24 @@ struct stdin_waiter : std::enable_shared_from_this<stdin_waiter>
void
rmrf
::
ev
::
loop
()
{
::
ev
::
default_loop
defloop
;
auto
w
=
std
::
make_shared
<
stdin_waiter
>
();
//
auto w = std::make_shared<stdin_waiter>();
defloop
.
run
(
0
);
}
void
stop_default_loop_cb
(
EV_P_
ev_async
*
event
,
int
)
{
::
ev
::
loop_ref
defloop
=
::
ev
::
get_default_loop
();
ev_async_stop
(
defloop
,
event
);
defloop
.
break_loop
();
}
void
rmrf
::
ev
::
stop
()
{
::
ev
::
loop_ref
defloop
=
::
ev
::
get_default_loop
();
// We need to use the C API directly as ev++ does not yet support asynchrounous events
ev_async
stop_event
;
ev_async_init
(
&
stop_event
,
stop_default_loop_cb
);
ev_async_start
(
defloop
,
&
stop_event
);
ev_async_send
(
defloop
,
&
stop_event
);
}
This diff is collapsed.
Click to expand it.
src/mumta/evloop.hpp
+
1
−
0
View file @
68f85842
...
...
@@ -12,5 +12,6 @@ bool init_libev();
bool
init_watchdog
();
void
loop
();
void
stop
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment