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
a854615b
Commit
a854615b
authored
Mar 26, 2013
by
Joseph Noir
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/opencl' of github.com:Neverlord/libcppa into topic/opencl
Conflicts: cppa/opencl/actor_facade.hpp
parents
5f67029e
e957731f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
23 deletions
+28
-23
cppa/event_based_actor.hpp
cppa/event_based_actor.hpp
+1
-1
src/event_based_actor.cpp
src/event_based_actor.cpp
+25
-10
src/thread_pool_scheduler.cpp
src/thread_pool_scheduler.cpp
+2
-12
No files found.
cppa/event_based_actor.hpp
View file @
a854615b
...
@@ -83,7 +83,7 @@ class event_based_actor : public scheduled_actor {
...
@@ -83,7 +83,7 @@ class event_based_actor : public scheduled_actor {
protected:
protected:
event_based_actor
();
event_based_actor
(
actor_state
st
=
actor_state
::
blocked
);
// provoke compiler errors for usage of receive() and related functions
// provoke compiler errors for usage of receive() and related functions
...
...
src/event_based_actor.cpp
View file @
a854615b
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
#include "cppa/logging.hpp"
#include "cppa/logging.hpp"
#include "cppa/event_based_actor.hpp"
#include "cppa/event_based_actor.hpp"
using
namespace
std
;
namespace
cppa
{
namespace
cppa
{
class
default_scheduled_actor
:
public
event_based_actor
{
class
default_scheduled_actor
:
public
event_based_actor
{
...
@@ -46,16 +48,28 @@ class default_scheduled_actor : public event_based_actor {
...
@@ -46,16 +48,28 @@ class default_scheduled_actor : public event_based_actor {
typedef
std
::
function
<
void
()
>
fun_type
;
typedef
std
::
function
<
void
()
>
fun_type
;
default_scheduled_actor
(
fun_type
&&
fun
)
:
m_fun
(
std
::
move
(
fun
))
{
}
default_scheduled_actor
(
fun_type
&&
fun
)
:
super
(
actor_state
::
ready
),
m_fun
(
std
::
move
(
fun
)),
m_initialized
(
false
)
{
}
void
init
()
{
become
(
void
init
()
{
}
on
(
atom
(
"RUN"
))
>>
[
=
]
{
CPPA_LOGS_TRACE
(
"init$lambda"
,
""
);
resume_result
resume
(
util
::
fiber
*
f
,
actor_ptr
&
next
)
{
unbecome
();
if
(
!
m_initialized
)
{
m_fun
();
scoped_self_setter
sss
{
this
};
m_initialized
=
true
;
m_fun
();
if
(
m_bhvr_stack
.
empty
())
{
if
(
exit_reason
()
==
exit_reason
::
not_exited
)
quit
(
exit_reason
::
normal
);
set_state
(
actor_state
::
done
);
m_bhvr_stack
.
clear
();
m_bhvr_stack
.
cleanup
();
on_exit
();
next
.
swap
(
m_chained_actor
);
set_state
(
actor_state
::
done
);
return
resume_result
::
actor_done
;
}
}
);
}
return
event_based_actor
::
resume
(
f
,
next
);
}
}
scheduled_actor_type
impl_type
()
{
scheduled_actor_type
impl_type
()
{
...
@@ -65,6 +79,7 @@ class default_scheduled_actor : public event_based_actor {
...
@@ -65,6 +79,7 @@ class default_scheduled_actor : public event_based_actor {
private:
private:
fun_type
m_fun
;
fun_type
m_fun
;
bool
m_initialized
;
};
};
...
@@ -72,7 +87,7 @@ intrusive_ptr<event_based_actor> event_based_actor::from(std::function<void()> f
...
@@ -72,7 +87,7 @@ intrusive_ptr<event_based_actor> event_based_actor::from(std::function<void()> f
return
detail
::
memory
::
create
<
default_scheduled_actor
>
(
std
::
move
(
fun
));
return
detail
::
memory
::
create
<
default_scheduled_actor
>
(
std
::
move
(
fun
));
}
}
event_based_actor
::
event_based_actor
(
)
:
super
(
actor_state
::
blocked
,
true
)
{
}
event_based_actor
::
event_based_actor
(
actor_state
st
)
:
super
(
st
,
true
)
{
}
void
event_based_actor
::
dequeue
(
behavior
&
)
{
void
event_based_actor
::
dequeue
(
behavior
&
)
{
quit
(
exit_reason
::
unallowed_function_call
);
quit
(
exit_reason
::
unallowed_function_call
);
...
...
src/thread_pool_scheduler.cpp
View file @
a854615b
...
@@ -209,20 +209,10 @@ actor_ptr thread_pool_scheduler::exec(spawn_options os, scheduled_actor_ptr p) {
...
@@ -209,20 +209,10 @@ actor_ptr thread_pool_scheduler::exec(spawn_options os, scheduled_actor_ptr p) {
return
std
::
move
(
p
);
return
std
::
move
(
p
);
}
}
p
->
attach_to_scheduler
(
this
,
is_hidden
);
p
->
attach_to_scheduler
(
this
,
is_hidden
);
if
(
p
->
has_behavior
())
{
if
(
p
->
has_behavior
()
||
p
->
impl_type
()
==
default_event_based_impl
)
{
if
(
!
is_hidden
)
get_actor_registry
()
->
inc_running
();
if
(
!
is_hidden
)
get_actor_registry
()
->
inc_running
();
p
->
ref
();
// implicit reference that's released if actor dies
p
->
ref
();
// implicit reference that's released if actor dies
switch
(
p
->
impl_type
())
{
if
(
p
->
impl_type
()
!=
event_based_impl
)
m_queue
.
push_back
(
p
.
get
());
case
default_event_based_impl
:
{
p
->
enqueue
(
nullptr
,
make_any_tuple
(
atom
(
"RUN"
)));
break
;
}
case
context_switching_impl
:
{
m_queue
.
push_back
(
p
.
get
());
break
;
}
default:
break
;
// nothing to do
}
}
}
else
p
->
on_exit
();
else
p
->
on_exit
();
return
std
::
move
(
p
);
return
std
::
move
(
p
);
...
...
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