Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
0242637b
Commit
0242637b
authored
Sep 02, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scheduler_helper
parent
59aa1fa3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
cppa/scheduler.hpp
cppa/scheduler.hpp
+5
-0
src/scheduler.cpp
src/scheduler.cpp
+34
-1
No files found.
cppa/scheduler.hpp
View file @
0242637b
...
...
@@ -11,6 +11,7 @@ namespace cppa {
class
context
;
class
actor_behavior
;
class
scheduler_helper
;
/**
* @brief
...
...
@@ -18,8 +19,12 @@ class actor_behavior;
class
scheduler
{
scheduler_helper
*
m_helper
;
protected:
scheduler
();
/**
* @brief Calls {@link context::exit(std::uint32_t) context::exit}.
*/
...
...
src/scheduler.cpp
View file @
0242637b
...
...
@@ -8,8 +8,9 @@
#include "cppa/context.hpp"
#include "cppa/scheduler.hpp"
#include "cppa/detail/actor_count.hpp"
//
#include "cppa/detail/mock_scheduler.hpp"
#include "cppa/detail/mock_scheduler.hpp"
#include "cppa/detail/thread_pool_scheduler.hpp"
#include "cppa/detail/converted_thread_context.hpp"
namespace
{
...
...
@@ -38,8 +39,40 @@ s_cleanup_helper;
namespace
cppa
{
class
scheduler_helper
{
cppa
::
intrusive_ptr
<
cppa
::
context
>
m_worker
;
static
void
worker_loop
(
cppa
::
intrusive_ptr
<
cppa
::
context
>
m_self
);
public:
scheduler_helper
()
:
m_worker
(
new
detail
::
converted_thread_context
)
{
// do NOT increase actor count; worker is "invisible"
boost
::
thread
(
&
scheduler_helper
::
worker_loop
,
m_worker
).
detach
();
}
~
scheduler_helper
()
{
m_worker
->
enqueue
(
message
(
m_worker
,
m_worker
,
atom
(
":_DIE"
)));
}
};
void
scheduler_helper
::
worker_loop
(
cppa
::
intrusive_ptr
<
cppa
::
context
>
m_self
)
{
set_self
(
m_self
.
get
());
}
scheduler
::
scheduler
()
:
m_helper
(
new
scheduler_helper
)
{
}
scheduler
::~
scheduler
()
{
delete
m_helper
;
}
void
scheduler
::
await_others_done
()
...
...
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