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
0a2ba938
Commit
0a2ba938
authored
Jun 12, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maintenance
parent
949892ea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
30 deletions
+27
-30
cppa/abstract_actor.hpp
cppa/abstract_actor.hpp
+4
-0
cppa/detail/converted_thread_context.hpp
cppa/detail/converted_thread_context.hpp
+0
-3
cppa/self.hpp
cppa/self.hpp
+12
-8
src/converted_thread_context.cpp
src/converted_thread_context.cpp
+0
-4
src/self.cpp
src/self.cpp
+9
-13
src/yielding_actor.cpp
src/yielding_actor.cpp
+2
-2
No files found.
cppa/abstract_actor.hpp
View file @
0a2ba938
...
@@ -53,6 +53,8 @@
...
@@ -53,6 +53,8 @@
namespace
cppa
{
namespace
cppa
{
class
self_type
;
/**
/**
* @brief Implements linking and monitoring for actors.
* @brief Implements linking and monitoring for actors.
* @tparam Base Either {@link cppa::actor actor}
* @tparam Base Either {@link cppa::actor actor}
...
@@ -61,6 +63,8 @@ namespace cppa {
...
@@ -61,6 +63,8 @@ namespace cppa {
template
<
class
Base
>
template
<
class
Base
>
class
abstract_actor
:
public
Base
{
class
abstract_actor
:
public
Base
{
friend
class
self_type
;
typedef
std
::
unique_ptr
<
attachable
>
attachable_ptr
;
typedef
std
::
unique_ptr
<
attachable
>
attachable_ptr
;
typedef
std
::
lock_guard
<
std
::
mutex
>
guard_type
;
typedef
std
::
lock_guard
<
std
::
mutex
>
guard_type
;
...
...
cppa/detail/converted_thread_context.hpp
View file @
0a2ba938
...
@@ -66,9 +66,6 @@ class converted_thread_context
...
@@ -66,9 +66,6 @@ class converted_thread_context
public:
public:
// called if the converted thread finished execution
void
cleanup
(
std
::
uint32_t
reason
=
exit_reason
::
normal
);
void
quit
(
std
::
uint32_t
reason
);
//override
void
quit
(
std
::
uint32_t
reason
);
//override
void
enqueue
(
actor
*
sender
,
any_tuple
msg
);
//override
void
enqueue
(
actor
*
sender
,
any_tuple
msg
);
//override
...
...
cppa/self.hpp
View file @
0a2ba938
...
@@ -51,14 +51,6 @@ class local_actor;
...
@@ -51,14 +51,6 @@ class local_actor;
// convertible<...> enables "actor_ptr this_actor = self;"
// convertible<...> enables "actor_ptr this_actor = self;"
class
self_type
:
public
convertible
<
self_type
,
actor
*>
{
class
self_type
:
public
convertible
<
self_type
,
actor
*>
{
static
void
set_impl
(
local_actor
*
);
static
local_actor
*
get_unchecked_impl
();
static
local_actor
*
get_impl
();
static
actor
*
convert_impl
();
self_type
(
const
self_type
&
)
=
delete
;
self_type
(
const
self_type
&
)
=
delete
;
self_type
&
operator
=
(
const
self_type
&
)
=
delete
;
self_type
&
operator
=
(
const
self_type
&
)
=
delete
;
...
@@ -91,6 +83,18 @@ class self_type : public convertible<self_type, actor*> {
...
@@ -91,6 +83,18 @@ class self_type : public convertible<self_type, actor*> {
return
get_unchecked_impl
();
return
get_unchecked_impl
();
}
}
static
void
cleanup_fun
(
local_actor
*
);
private:
static
void
set_impl
(
local_actor
*
);
static
local_actor
*
get_unchecked_impl
();
static
local_actor
*
get_impl
();
static
actor
*
convert_impl
();
};
};
/*
/*
...
...
src/converted_thread_context.cpp
View file @
0a2ba938
...
@@ -50,10 +50,6 @@ void converted_thread_context::quit(std::uint32_t reason) {
...
@@ -50,10 +50,6 @@ void converted_thread_context::quit(std::uint32_t reason) {
throw
actor_exited
(
reason
);
throw
actor_exited
(
reason
);
}
}
void
converted_thread_context
::
cleanup
(
std
::
uint32_t
reason
)
{
super
::
cleanup
(
reason
);
}
void
converted_thread_context
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
void
converted_thread_context
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
auto
node
=
fetch_node
(
sender
,
std
::
move
(
msg
));
auto
node
=
fetch_node
(
sender
,
std
::
move
(
msg
));
CPPA_REQUIRE
(
node
->
marked
==
false
);
CPPA_REQUIRE
(
node
->
marked
==
false
);
...
...
src/self.cpp
View file @
0a2ba938
...
@@ -38,12 +38,16 @@
...
@@ -38,12 +38,16 @@
#include "cppa/local_actor.hpp"
#include "cppa/local_actor.hpp"
#include "cppa/detail/converted_thread_context.hpp"
#include "cppa/detail/converted_thread_context.hpp"
using
cppa
::
detail
::
converted_thread_context
;
namespace
{
namespace
{
void
cleanup_fun
(
cppa
::
local_actor
*
what
)
{
boost
::
thread_specific_ptr
<
cppa
::
local_actor
>
t_this_context
(
&
cppa
::
self_type
::
cleanup_fun
);
auto
ptr
=
dynamic_cast
<
converted_thread_context
*>
(
what
);
}
// namespace <anonymous>
namespace
cppa
{
void
self_type
::
cleanup_fun
(
cppa
::
local_actor
*
what
)
{
auto
ptr
=
dynamic_cast
<
detail
::
converted_thread_context
*>
(
what
);
if
(
ptr
)
{
if
(
ptr
)
{
// make sure "unspawned" actors quit properly
// make sure "unspawned" actors quit properly
ptr
->
cleanup
(
cppa
::
exit_reason
::
normal
);
ptr
->
cleanup
(
cppa
::
exit_reason
::
normal
);
...
@@ -51,14 +55,6 @@ void cleanup_fun(cppa::local_actor* what) {
...
@@ -51,14 +55,6 @@ void cleanup_fun(cppa::local_actor* what) {
if
(
what
&&
!
what
->
deref
())
delete
what
;
if
(
what
&&
!
what
->
deref
())
delete
what
;
}
}
boost
::
thread_specific_ptr
<
cppa
::
local_actor
>
t_this_context
(
cleanup_fun
);
}
// namespace <anonymous>
namespace
cppa
{
//self_type self;
void
self_type
::
set_impl
(
local_actor
*
ptr
)
{
void
self_type
::
set_impl
(
local_actor
*
ptr
)
{
if
(
ptr
)
ptr
->
ref
();
if
(
ptr
)
ptr
->
ref
();
t_this_context
.
reset
(
ptr
);
t_this_context
.
reset
(
ptr
);
...
@@ -67,7 +63,7 @@ void self_type::set_impl(local_actor* ptr) {
...
@@ -67,7 +63,7 @@ void self_type::set_impl(local_actor* ptr) {
local_actor
*
self_type
::
get_impl
()
{
local_actor
*
self_type
::
get_impl
()
{
auto
result
=
t_this_context
.
get
();
auto
result
=
t_this_context
.
get
();
if
(
result
==
nullptr
)
{
if
(
result
==
nullptr
)
{
result
=
new
converted_thread_context
;
result
=
new
detail
::
converted_thread_context
;
result
->
ref
();
result
->
ref
();
get_scheduler
()
->
register_converted_context
(
result
);
get_scheduler
()
->
register_converted_context
(
result
);
t_this_context
.
reset
(
result
);
t_this_context
.
reset
(
result
);
...
...
src/yielding_actor.cpp
View file @
0a2ba938
...
@@ -62,11 +62,11 @@ void yielding_actor::run(void* ptr_arg) {
...
@@ -62,11 +62,11 @@ void yielding_actor::run(void* ptr_arg) {
yield
(
yield_state
::
done
);
yield
(
yield_state
::
done
);
}
}
void
yielding_actor
::
yield_until_not_empty
()
{
void
yielding_actor
::
yield_until_not_empty
()
{
if
(
m_mailbox
.
can_fetch_more
()
==
false
)
{
if
(
m_mailbox
.
can_fetch_more
()
==
false
)
{
m_state
.
store
(
abstract_scheduled_actor
::
about_to_block
);
m_state
.
store
(
abstract_scheduled_actor
::
about_to_block
);
CPPA_MEMORY_BARRIER
();
std
::
atomic_thread_fence
(
std
::
memory_order_seq_cst
);
//CPPA_MEMORY_BARRIER();
// make sure mailbox is empty
// make sure mailbox is empty
if
(
m_mailbox
.
can_fetch_more
()
==
false
)
{
if
(
m_mailbox
.
can_fetch_more
()
==
false
)
{
m_state
.
store
(
abstract_scheduled_actor
::
ready
);
m_state
.
store
(
abstract_scheduled_actor
::
ready
);
...
...
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