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
278cc01c
Commit
278cc01c
authored
Mar 24, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enum filter_result => enum class msg_type
parent
c79c45d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
cppa/policy/invoke_policy.hpp
cppa/policy/invoke_policy.hpp
+29
-29
No files found.
cppa/policy/invoke_policy.hpp
View file @
278cc01c
...
@@ -128,16 +128,16 @@ class invoke_policy {
...
@@ -128,16 +128,16 @@ class invoke_policy {
CPPA_CRITICAL
(
"handle_timeout(partial_function&)"
);
CPPA_CRITICAL
(
"handle_timeout(partial_function&)"
);
}
}
enum
filter_result
{
enum
class
msg_type
{
normal_exit
_signal
,
// an exit message with normal exit reason
normal_exit
,
// an exit message with normal exit reason
non_normal_exit
_signal
,
// an exit message with abnormal exit reason
non_normal_exit
,
// an exit message with abnormal exit reason
expired_timeout
_message
,
// an 'old & obsolete' timeout
expired_timeout
,
// an 'old & obsolete' timeout
inactive_timeout
_message
,
// a currently inactive timeout
inactive_timeout
,
// a currently inactive timeout
expired_sync_response
,
// a sync response that already timed out
expired_sync_response
,
// a sync response that already timed out
timeout
_message
,
// triggers currently active timeout
timeout
,
// triggers currently active timeout
timeout_response
_message
,
// triggers timeout of a sync message
timeout_response
,
// triggers timeout of a sync message
ordinary
_message
,
// an asynchronous message or sync. request
ordinary
,
// an asynchronous message or sync. request
sync_response
// a synchronous response
sync_response
// a synchronous response
};
};
...
@@ -146,7 +146,7 @@ class invoke_policy {
...
@@ -146,7 +146,7 @@ class invoke_policy {
// - expired synchronous response messages
// - expired synchronous response messages
template
<
class
Actor
>
template
<
class
Actor
>
filter_result
filter_msg
(
Actor
*
self
,
mailbox_element
*
node
)
{
msg_type
filter_msg
(
Actor
*
self
,
mailbox_element
*
node
)
{
const
any_tuple
&
msg
=
node
->
msg
;
const
any_tuple
&
msg
=
node
->
msg
;
auto
mid
=
node
->
mid
;
auto
mid
=
node
->
mid
;
auto
&
arr
=
detail
::
static_types_array
<
exit_msg
,
auto
&
arr
=
detail
::
static_types_array
<
exit_msg
,
...
@@ -159,28 +159,28 @@ class invoke_policy {
...
@@ -159,28 +159,28 @@ class invoke_policy {
if
(
self
->
trap_exit
()
==
false
)
{
if
(
self
->
trap_exit
()
==
false
)
{
if
(
em
.
reason
!=
exit_reason
::
normal
)
{
if
(
em
.
reason
!=
exit_reason
::
normal
)
{
self
->
quit
(
em
.
reason
);
self
->
quit
(
em
.
reason
);
return
non_normal_exit_signal
;
return
msg_type
::
non_normal_exit
;
}
}
return
normal_exit_signal
;
return
msg_type
::
normal_exit
;
}
}
}
}
else
if
(
msg
.
type_at
(
0
)
==
arr
[
1
])
{
else
if
(
msg
.
type_at
(
0
)
==
arr
[
1
])
{
auto
&
tm
=
msg
.
get_as
<
timeout_msg
>
(
0
);
auto
&
tm
=
msg
.
get_as
<
timeout_msg
>
(
0
);
auto
tid
=
tm
.
timeout_id
;
auto
tid
=
tm
.
timeout_id
;
CPPA_REQUIRE
(
!
mid
.
valid
());
CPPA_REQUIRE
(
!
mid
.
valid
());
if
(
self
->
is_active_timeout
(
tid
))
return
timeout_message
;
if
(
self
->
is_active_timeout
(
tid
))
return
msg_type
::
timeout
;
return
self
->
waits_for_timeout
(
tid
)
?
inactive_timeout_message
return
self
->
waits_for_timeout
(
tid
)
?
msg_type
::
inactive_timeout
:
expired_timeout_message
;
:
msg_type
::
expired_timeout
;
}
}
else
if
(
msg
.
type_at
(
0
)
==
arr
[
2
]
&&
mid
.
is_response
())
{
else
if
(
msg
.
type_at
(
0
)
==
arr
[
2
]
&&
mid
.
is_response
())
{
return
timeout_response_messag
e
;
return
msg_type
::
timeout_respons
e
;
}
}
}
}
if
(
mid
.
is_response
())
{
if
(
mid
.
is_response
())
{
return
(
self
->
awaits
(
mid
))
?
sync_response
return
(
self
->
awaits
(
mid
))
?
msg_type
::
sync_response
:
expired_sync_response
;
:
msg_type
::
expired_sync_response
;
}
}
return
ordinary_message
;
return
msg_type
::
ordinary
;
}
}
public:
public:
...
@@ -292,29 +292,29 @@ class invoke_policy {
...
@@ -292,29 +292,29 @@ class invoke_policy {
return
hm_skip_msg
;
return
hm_skip_msg
;
}
}
switch
(
this
->
filter_msg
(
self
,
node
))
{
switch
(
this
->
filter_msg
(
self
,
node
))
{
case
normal_exit_signal
:
{
case
msg_type
:
:
normal_exit
:
{
CPPA_LOG_DEBUG
(
"dropped normal exit signal"
);
CPPA_LOG_DEBUG
(
"dropped normal exit signal"
);
return
hm_drop_msg
;
return
hm_drop_msg
;
}
}
case
expired_sync_response
:
{
case
msg_type
:
:
expired_sync_response
:
{
CPPA_LOG_DEBUG
(
"dropped expired sync response"
);
CPPA_LOG_DEBUG
(
"dropped expired sync response"
);
return
hm_drop_msg
;
return
hm_drop_msg
;
}
}
case
expired_timeout_message
:
{
case
msg_type
:
:
expired_timeout
:
{
CPPA_LOG_DEBUG
(
"dropped expired timeout message"
);
CPPA_LOG_DEBUG
(
"dropped expired timeout message"
);
return
hm_drop_msg
;
return
hm_drop_msg
;
}
}
case
inactive_timeout_message
:
{
case
msg_type
:
:
inactive_timeout
:
{
CPPA_LOG_DEBUG
(
"skipped inactive timeout message"
);
CPPA_LOG_DEBUG
(
"skipped inactive timeout message"
);
return
hm_skip_msg
;
return
hm_skip_msg
;
}
}
case
non_normal_exit_signal
:
{
case
msg_type
:
:
non_normal_exit
:
{
CPPA_LOG_DEBUG
(
"handled non-normal exit signal"
);
CPPA_LOG_DEBUG
(
"handled non-normal exit signal"
);
// this message was handled
// this message was handled
// by calling self->quit(...)
// by calling self->quit(...)
return
hm_msg_handled
;
return
hm_msg_handled
;
}
}
case
timeout_message
:
{
case
msg_type
:
:
timeout
:
{
CPPA_LOG_DEBUG
(
"handle timeout message"
);
CPPA_LOG_DEBUG
(
"handle timeout message"
);
auto
&
tm
=
node
->
msg
.
get_as
<
timeout_msg
>
(
0
);
auto
&
tm
=
node
->
msg
.
get_as
<
timeout_msg
>
(
0
);
self
->
handle_timeout
(
fun
,
tm
.
timeout_id
);
self
->
handle_timeout
(
fun
,
tm
.
timeout_id
);
...
@@ -324,11 +324,11 @@ class invoke_policy {
...
@@ -324,11 +324,11 @@ class invoke_policy {
}
}
return
hm_msg_handled
;
return
hm_msg_handled
;
}
}
case
timeout_response_messag
e
:
{
case
msg_type
:
:
timeout_respons
e
:
{
handle_sync_failure_on_mismatch
=
false
;
handle_sync_failure_on_mismatch
=
false
;
CPPA_ANNOTATE_FALLTHROUGH
;
CPPA_ANNOTATE_FALLTHROUGH
;
}
}
case
sync_response
:
{
case
msg_type
:
:
sync_response
:
{
CPPA_LOG_DEBUG
(
"handle as synchronous response: "
CPPA_LOG_DEBUG
(
"handle as synchronous response: "
<<
CPPA_TARG
(
node
->
msg
,
to_string
)
<<
", "
<<
CPPA_TARG
(
node
->
msg
,
to_string
)
<<
", "
<<
CPPA_MARG
(
node
->
mid
,
integer_value
)
<<
", "
<<
CPPA_MARG
(
node
->
mid
,
integer_value
)
<<
", "
...
@@ -351,7 +351,7 @@ class invoke_policy {
...
@@ -351,7 +351,7 @@ class invoke_policy {
}
}
return
hm_cache_msg
;
return
hm_cache_msg
;
}
}
case
ordinary_message
:
{
case
msg_type
:
:
ordinary
:
{
if
(
!
awaited_response
.
valid
())
{
if
(
!
awaited_response
.
valid
())
{
auto
previous_node
=
dptr
()
->
hm_begin
(
self
,
node
);
auto
previous_node
=
dptr
()
->
hm_begin
(
self
,
node
);
auto
res
=
invoke_fun
(
self
,
auto
res
=
invoke_fun
(
self
,
...
...
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