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
e1f51dc0
Commit
e1f51dc0
authored
Feb 05, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in timed_sync_send
parent
f543c4a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
18 deletions
+25
-18
cppa/detail/receive_policy.hpp
cppa/detail/receive_policy.hpp
+21
-15
src/event_based_actor.cpp
src/event_based_actor.cpp
+4
-3
No files found.
cppa/detail/receive_policy.hpp
View file @
e1f51dc0
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include <type_traits>
#include <type_traits>
#include "cppa/behavior.hpp"
#include "cppa/behavior.hpp"
#include "cppa/to_string.hpp"
#include "cppa/message_id.hpp"
#include "cppa/message_id.hpp"
#include "cppa/exit_reason.hpp"
#include "cppa/exit_reason.hpp"
#include "cppa/partial_function.hpp"
#include "cppa/partial_function.hpp"
...
@@ -133,8 +134,8 @@ class receive_policy {
...
@@ -133,8 +134,8 @@ class receive_policy {
template
<
class
Client
,
class
FunOrBehavior
>
template
<
class
Client
,
class
FunOrBehavior
>
inline
void
receive_wo_timeout
(
Client
*
client
,
FunOrBehavior
&
fun
)
{
inline
void
receive_wo_timeout
(
Client
*
client
,
FunOrBehavior
&
fun
)
{
if
(
invoke_from_cache
(
client
,
fun
)
==
false
)
{
if
(
!
invoke_from_cache
(
client
,
fun
)
)
{
while
(
invoke
(
client
,
client
->
receive_node
(),
fun
)
==
false
)
{
}
while
(
!
invoke
(
client
,
client
->
receive_node
(),
fun
)
)
{
}
}
}
}
}
...
@@ -145,10 +146,10 @@ class receive_policy {
...
@@ -145,10 +146,10 @@ class receive_policy {
template
<
class
Client
>
template
<
class
Client
>
void
receive
(
Client
*
client
,
behavior
&
bhvr
)
{
void
receive
(
Client
*
client
,
behavior
&
bhvr
)
{
if
(
bhvr
.
timeout
().
valid
()
==
false
)
{
if
(
!
bhvr
.
timeout
().
valid
()
)
{
receive_wo_timeout
(
client
,
bhvr
);
receive_wo_timeout
(
client
,
bhvr
);
}
}
else
if
(
invoke_from_cache
(
client
,
bhvr
)
==
false
)
{
else
if
(
!
invoke_from_cache
(
client
,
bhvr
)
)
{
if
(
bhvr
.
timeout
().
is_zero
())
{
if
(
bhvr
.
timeout
().
is_zero
())
{
pointer
e
=
nullptr
;
pointer
e
=
nullptr
;
while
((
e
=
client
->
try_receive_node
())
!=
nullptr
)
{
while
((
e
=
client
->
try_receive_node
())
!=
nullptr
)
{
...
@@ -174,20 +175,25 @@ class receive_policy {
...
@@ -174,20 +175,25 @@ class receive_policy {
}
}
template
<
class
Client
>
template
<
class
Client
>
void
receive
(
Client
*
client
,
behavior
&
bhvr
,
message_id_t
awaited_response
)
{
void
receive
(
Client
*
client
,
behavior
&
bhvr
,
message_id_t
mid
)
{
CPPA_REQUIRE
(
bhvr
.
timeout
().
valid
());
CPPA_REQUIRE
(
mid
.
is_response
());
if
(
!
invoke_from_cache
(
client
,
bhvr
,
mid
))
{
if
(
bhvr
.
timeout
().
valid
())
{
CPPA_REQUIRE
(
bhvr
.
timeout
().
is_zero
()
==
false
);
CPPA_REQUIRE
(
bhvr
.
timeout
().
is_zero
()
==
false
);
if
(
invoke_from_cache
(
client
,
bhvr
,
awaited_response
)
==
false
)
{
auto
timeout
=
client
->
init_timeout
(
bhvr
.
timeout
());
auto
timeout
=
client
->
init_timeout
(
bhvr
.
timeout
());
pointer
e
=
nullptr
;
pointer
e
=
nullptr
;
while
((
e
=
client
->
try_receive_node
(
timeout
))
!=
nullptr
)
{
while
((
e
=
client
->
try_receive_node
(
timeout
))
!=
nullptr
)
{
CPPA_REQUIRE
(
e
->
marked
==
false
);
CPPA_REQUIRE
(
e
->
marked
==
false
);
if
(
invoke
(
client
,
e
,
bhvr
,
awaited_response
))
{
if
(
invoke
(
client
,
e
,
bhvr
,
mid
))
{
return
;
// done
return
;
// done
}
}
}
}
handle_timeout
(
client
,
bhvr
);
handle_timeout
(
client
,
bhvr
);
}
}
else
{
while
(
!
invoke
(
client
,
client
->
receive_node
(),
bhvr
,
mid
))
{
}
}
}
}
}
private:
private:
...
...
src/event_based_actor.cpp
View file @
e1f51dc0
...
@@ -141,9 +141,10 @@ void event_based_actor::do_become(behavior&& bhvr, bool discard_old) {
...
@@ -141,9 +141,10 @@ void event_based_actor::do_become(behavior&& bhvr, bool discard_old) {
}
}
void
event_based_actor
::
become_waiting_for
(
behavior
&&
bhvr
,
message_id_t
mf
)
{
void
event_based_actor
::
become_waiting_for
(
behavior
&&
bhvr
,
message_id_t
mf
)
{
CPPA_REQUIRE
(
bhvr
.
timeout
().
valid
());
if
(
bhvr
.
timeout
().
valid
())
{
reset_timeout
();
reset_timeout
();
request_timeout
(
bhvr
.
timeout
());
request_timeout
(
bhvr
.
timeout
());
}
m_bhvr_stack
.
push_back
(
std
::
move
(
bhvr
),
mf
);
m_bhvr_stack
.
push_back
(
std
::
move
(
bhvr
),
mf
);
}
}
...
...
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