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
7aeaa35a
Commit
7aeaa35a
authored
Dec 12, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
2a2327f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
31 deletions
+54
-31
cppa/abstract_event_based_actor.hpp
cppa/abstract_event_based_actor.hpp
+28
-2
cppa/event_based_actor_mixin.hpp
cppa/event_based_actor_mixin.hpp
+4
-0
cppa/invoke_rules.hpp
cppa/invoke_rules.hpp
+0
-2
cppa/util/either.hpp
cppa/util/either.hpp
+12
-12
src/abstract_scheduled_actor.cpp
src/abstract_scheduled_actor.cpp
+8
-8
src/invoke_rules.cpp
src/invoke_rules.cpp
+2
-7
No files found.
cppa/abstract_event_based_actor.hpp
View file @
7aeaa35a
...
@@ -61,16 +61,38 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
...
@@ -61,16 +61,38 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
struct
stack_element
struct
stack_element
{
{
stack_element
()
=
delete
;
stack_element
(
const
stack_element
&
)
=
delete
;
stack_element
&
operator
=
(
const
stack_element
&
)
=
delete
;
util
::
either
<
invoke_rules
*
,
timed_invoke_rules
*>
m_ptr
;
util
::
either
<
invoke_rules
*
,
timed_invoke_rules
*>
m_ptr
;
bool
m_ownership
;
bool
m_ownership
;
inline
stack_element
(
invoke_rules
*
ptr
,
bool
take_ownership
)
inline
stack_element
(
invoke_rules
*
ptr
,
bool
take_ownership
)
:
m_ptr
(
ptr
),
m_ownership
(
take_ownership
)
:
m_ptr
(
ptr
),
m_ownership
(
take_ownership
)
{
{
}
}
inline
stack_element
(
timed_invoke_rules
*
ptr
,
bool
take_ownership
)
inline
stack_element
(
timed_invoke_rules
*
ptr
,
bool
take_ownership
)
:
m_ptr
(
ptr
),
m_ownership
(
take_ownership
)
:
m_ptr
(
ptr
),
m_ownership
(
take_ownership
)
{
{
}
}
inline
stack_element
(
stack_element
&&
other
)
:
m_ptr
(
other
.
m_ptr
),
m_ownership
(
other
.
m_ownership
)
{
other
.
m_ownership
=
false
;
}
inline
stack_element
&
operator
=
(
stack_element
&&
other
)
{
m_ptr
=
other
.
m_ptr
;
m_ownership
=
other
.
m_ownership
;
other
.
m_ownership
=
false
;
return
*
this
;
}
inline
~
stack_element
()
inline
~
stack_element
()
{
{
if
(
m_ownership
)
if
(
m_ownership
)
...
@@ -95,11 +117,15 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
...
@@ -95,11 +117,15 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
}
}
inline
invoke_rules
&
left
()
inline
invoke_rules
&
left
()
{
{
return
*
(
m_ptr
.
left
());
auto
ptr
=
m_ptr
.
left
();
if
(
ptr
==
nullptr
)
throw
std
::
runtime_error
(
"nullptr"
);
return
*
(
ptr
);
}
}
inline
timed_invoke_rules
&
right
()
inline
timed_invoke_rules
&
right
()
{
{
return
*
(
m_ptr
.
right
());
auto
ptr
=
m_ptr
.
right
();
if
(
ptr
==
nullptr
)
throw
std
::
runtime_error
(
"nullptr"
);
return
*
(
ptr
);
}
}
};
};
...
...
cppa/event_based_actor_mixin.hpp
View file @
7aeaa35a
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
#include "cppa/abstract_event_based_actor.hpp"
#include "cppa/abstract_event_based_actor.hpp"
#include <iostream>
using
std
::
cout
;
using
std
::
endl
;
namespace
cppa
{
namespace
cppa
{
template
<
typename
Derived
>
template
<
typename
Derived
>
...
...
cppa/invoke_rules.hpp
View file @
7aeaa35a
...
@@ -73,8 +73,6 @@ class invoke_rules_base
...
@@ -73,8 +73,6 @@ class invoke_rules_base
invoke_rules_base
(
invokable_list
&&
ilist
);
invoke_rules_base
(
invokable_list
&&
ilist
);
invoke_rules_base
(
invoke_rules_base
&&
other
);
protected:
protected:
invokable_list
m_list
;
invokable_list
m_list
;
...
...
cppa/util/either.hpp
View file @
7aeaa35a
...
@@ -87,11 +87,11 @@ class either
...
@@ -87,11 +87,11 @@ class either
{
{
if
(
other
.
m_is_left
)
if
(
other
.
m_is_left
)
{
{
cr_left
(
other
.
left
()
);
cr_left
(
other
.
m_left
);
}
}
else
else
{
{
cr_right
(
other
.
right
()
);
cr_right
(
other
.
m_right
);
}
}
}
}
...
@@ -99,11 +99,11 @@ class either
...
@@ -99,11 +99,11 @@ class either
{
{
if
(
other
.
m_is_left
)
if
(
other
.
m_is_left
)
{
{
cr_left
(
std
::
move
(
other
.
left
()
));
cr_left
(
std
::
move
(
other
.
m_left
));
}
}
else
else
{
{
cr_right
(
std
::
move
(
other
.
right
()
));
cr_right
(
std
::
move
(
other
.
m_right
));
}
}
}
}
...
@@ -118,11 +118,11 @@ class either
...
@@ -118,11 +118,11 @@ class either
{
{
if
(
m_is_left
)
if
(
m_is_left
)
{
{
left
()
=
other
.
left
()
;
m_left
=
other
.
m_left
;
}
}
else
else
{
{
right
()
=
other
.
right
()
;
m_right
=
other
.
m_right
;
}
}
}
}
else
else
...
@@ -131,11 +131,11 @@ class either
...
@@ -131,11 +131,11 @@ class either
m_is_left
=
other
.
m_is_left
;
m_is_left
=
other
.
m_is_left
;
if
(
other
.
m_is_left
)
if
(
other
.
m_is_left
)
{
{
cr_left
(
other
.
left
()
);
cr_left
(
other
.
m_left
);
}
}
else
else
{
{
cr_right
(
other
.
right
()
);
cr_right
(
other
.
m_right
);
}
}
}
}
return
*
this
;
return
*
this
;
...
@@ -147,11 +147,11 @@ class either
...
@@ -147,11 +147,11 @@ class either
{
{
if
(
m_is_left
)
if
(
m_is_left
)
{
{
left
()
=
std
::
move
(
other
.
left
()
);
m_left
=
std
::
move
(
other
.
m_left
);
}
}
else
else
{
{
right
()
=
std
::
move
(
other
.
right
()
);
m_right
=
std
::
move
(
other
.
m_right
);
}
}
}
}
else
else
...
@@ -160,11 +160,11 @@ class either
...
@@ -160,11 +160,11 @@ class either
m_is_left
=
other
.
m_is_left
;
m_is_left
=
other
.
m_is_left
;
if
(
other
.
m_is_left
)
if
(
other
.
m_is_left
)
{
{
cr_left
(
std
::
move
(
other
.
left
()
));
cr_left
(
std
::
move
(
other
.
m_left
));
}
}
else
else
{
{
cr_right
(
std
::
move
(
other
.
right
()
));
cr_right
(
std
::
move
(
other
.
m_right
));
}
}
}
}
return
*
this
;
return
*
this
;
...
...
src/abstract_scheduled_actor.cpp
View file @
7aeaa35a
...
@@ -4,10 +4,10 @@
...
@@ -4,10 +4,10 @@
#include "cppa/detail/abstract_scheduled_actor.hpp"
#include "cppa/detail/abstract_scheduled_actor.hpp"
#include "cppa/detail/yield_interface.hpp"
#include "cppa/detail/yield_interface.hpp"
namespace
{
void
dummy_enqueue
(
void
*
,
cppa
::
detail
::
abstract_scheduled_actor
*
)
{
}
}
namespace
cppa
{
namespace
detail
{
namespace
cppa
{
namespace
detail
{
namespace
{
void
dummy_enqueue
(
void
*
,
abstract_scheduled_actor
*
)
{
}
}
abstract_scheduled_actor
::
abstract_scheduled_actor
()
abstract_scheduled_actor
::
abstract_scheduled_actor
()
:
next
(
nullptr
)
:
next
(
nullptr
)
,
m_state
(
abstract_scheduled_actor
::
done
)
,
m_state
(
abstract_scheduled_actor
::
done
)
...
@@ -25,7 +25,6 @@ void abstract_scheduled_actor::quit(std::uint32_t reason)
...
@@ -25,7 +25,6 @@ void abstract_scheduled_actor::quit(std::uint32_t reason)
{
{
cleanup
(
reason
);
cleanup
(
reason
);
throw
actor_exited
(
reason
);
throw
actor_exited
(
reason
);
//yield(yield_state::done);
}
}
void
abstract_scheduled_actor
::
enqueue_node
(
queue_node
*
node
)
void
abstract_scheduled_actor
::
enqueue_node
(
queue_node
*
node
)
...
@@ -70,7 +69,8 @@ void abstract_scheduled_actor::enqueue(actor* sender, const any_tuple& msg)
...
@@ -70,7 +69,8 @@ void abstract_scheduled_actor::enqueue(actor* sender, const any_tuple& msg)
enqueue_node
(
new
queue_node
(
sender
,
msg
));
enqueue_node
(
new
queue_node
(
sender
,
msg
));
}
}
int
abstract_scheduled_actor
::
compare_exchange_state
(
int
expected
,
int
new_value
)
int
abstract_scheduled_actor
::
compare_exchange_state
(
int
expected
,
int
new_value
)
{
{
int
e
=
expected
;
int
e
=
expected
;
do
do
...
@@ -90,7 +90,7 @@ void abstract_scheduled_actor::request_timeout(const util::duration& d)
...
@@ -90,7 +90,7 @@ void abstract_scheduled_actor::request_timeout(const util::duration& d)
m_has_pending_timeout_request
=
true
;
m_has_pending_timeout_request
=
true
;
}
}
a
bstract_scheduled_actor
::
filter_result
abstract_scheduled_actor
::
filter_msg
(
const
any_tuple
&
msg
)
a
uto
abstract_scheduled_actor
::
filter_msg
(
const
any_tuple
&
msg
)
->
filter_result
{
{
if
(
m_pattern
(
msg
))
if
(
m_pattern
(
msg
))
{
{
...
@@ -116,9 +116,9 @@ abstract_scheduled_actor::filter_result abstract_scheduled_actor::filter_msg(con
...
@@ -116,9 +116,9 @@ abstract_scheduled_actor::filter_result abstract_scheduled_actor::filter_msg(con
return
ordinary_message
;
return
ordinary_message
;
}
}
a
bstract_scheduled_actor
::
dq_result
abstract_scheduled_actor
::
dq
(
std
::
unique_ptr
<
queue_node
>&
node
,
a
uto
abstract_scheduled_actor
::
dq
(
std
::
unique_ptr
<
queue_node
>&
node
,
invoke_rules_base
&
rules
,
invoke_rules_base
&
rules
,
queue_node_buffer
&
buffer
)
queue_node_buffer
&
buffer
)
->
dq_result
{
{
switch
(
filter_msg
(
node
->
msg
))
switch
(
filter_msg
(
node
->
msg
))
{
{
...
...
src/invoke_rules.cpp
View file @
7aeaa35a
...
@@ -36,11 +36,6 @@ namespace cppa {
...
@@ -36,11 +36,6 @@ namespace cppa {
util
::
duration
timed_invoke_rules
::
default_timeout
;
util
::
duration
timed_invoke_rules
::
default_timeout
;
// invoke_rules_base
// invoke_rules_base
invoke_rules_base
::
invoke_rules_base
(
invoke_rules_base
&&
other
)
:
m_list
(
std
::
move
(
other
.
m_list
))
{
}
invoke_rules_base
::
invoke_rules_base
(
invokable_list
&&
ilist
)
invoke_rules_base
::
invoke_rules_base
(
invokable_list
&&
ilist
)
:
m_list
(
std
::
move
(
ilist
))
:
m_list
(
std
::
move
(
ilist
))
{
{
...
@@ -78,7 +73,7 @@ timed_invoke_rules::timed_invoke_rules()
...
@@ -78,7 +73,7 @@ timed_invoke_rules::timed_invoke_rules()
}
}
timed_invoke_rules
::
timed_invoke_rules
(
timed_invoke_rules
&&
other
)
timed_invoke_rules
::
timed_invoke_rules
(
timed_invoke_rules
&&
other
)
:
super
(
std
::
move
(
other
)),
m_ti
(
std
::
move
(
other
.
m_ti
))
:
super
(
std
::
move
(
other
.
m_list
)),
m_ti
(
std
::
move
(
other
.
m_ti
))
{
{
}
}
...
@@ -119,7 +114,7 @@ invoke_rules::invoke_rules(invokable_list&& ll) : super(std::move(ll))
...
@@ -119,7 +114,7 @@ invoke_rules::invoke_rules(invokable_list&& ll) : super(std::move(ll))
{
{
}
}
invoke_rules
::
invoke_rules
(
invoke_rules
&&
other
)
:
super
(
std
::
move
(
other
))
invoke_rules
::
invoke_rules
(
invoke_rules
&&
other
)
:
super
(
std
::
move
(
other
.
m_list
))
{
{
}
}
...
...
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