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
d967328b
Commit
d967328b
authored
Apr 17, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maintenance
parent
6a73baa0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
17 deletions
+28
-17
cppa/abstract_event_based_actor.hpp
cppa/abstract_event_based_actor.hpp
+1
-0
cppa/intrusive/single_reader_queue.hpp
cppa/intrusive/single_reader_queue.hpp
+5
-3
src/abstract_event_based_actor.cpp
src/abstract_event_based_actor.cpp
+21
-14
src/abstract_scheduled_actor.cpp
src/abstract_scheduled_actor.cpp
+1
-0
No files found.
cppa/abstract_event_based_actor.hpp
View file @
d967328b
...
...
@@ -136,6 +136,7 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
private:
bool
handle_message
(
queue_node
&
iter
);
bool
invoke_from_cache
();
};
...
...
cppa/intrusive/single_reader_queue.hpp
View file @
d967328b
...
...
@@ -35,6 +35,7 @@
#include <atomic>
#include <memory>
#include "cppa/config.hpp"
#include "cppa/detail/thread.hpp"
namespace
cppa
{
namespace
intrusive
{
...
...
@@ -245,8 +246,9 @@ class single_reader_queue
// next iteration
e
=
next
;
}
CPPA_REQUIRE
(
tmp
.
empty
()
==
false
);
if
(
iter
)
*
iter
=
tmp
.
begin
();
m_cache
.
splice
(
m_cache
.
end
(),
tmp
);
m_cache
.
splice
(
m_cache
.
end
(),
std
::
move
(
tmp
)
);
return
true
;
}
// next iteration
...
...
@@ -259,11 +261,11 @@ class single_reader_queue
{
if
(
!
m_cache
.
empty
()
||
fetch_new_data
())
{
auto
result
=
std
::
move
(
m_cache
.
front
());
unique_pointer
result
=
std
::
move
(
m_cache
.
front
());
m_cache
.
pop_front
();
return
std
::
move
(
result
);
}
return
nullptr
;
return
{}
;
}
};
...
...
src/abstract_event_based_actor.cpp
View file @
d967328b
...
...
@@ -86,25 +86,36 @@ bool abstract_event_based_actor::handle_message(queue_node& node)
}
}
bool
abstract_event_based_actor
::
invoke_from_cache
()
{
for
(
auto
i
=
m_mailbox_pos
;
i
!=
m_mailbox
.
cache
().
end
();
++
i
)
{
if
(
handle_message
(
*
(
*
i
)))
{
m_mailbox
.
cache
().
erase
(
i
);
return
true
;
}
}
return
false
;
}
void
abstract_event_based_actor
::
resume
(
util
::
fiber
*
,
resume_callback
*
callback
)
{
self
.
set
(
this
);
auto
done_cb
=
[
this
,
callback
]()
auto
done_cb
=
[
=
]()
{
m_state
.
store
(
abstract_scheduled_actor
::
done
);
while
(
!
m_loop_stack
.
empty
())
m_loop_stack
.
pop_back
();
on_exit
();
callback
->
exec_done
();
};
if
(
m_loop_stack
.
empty
())
{
cleanup
(
exit_reason
::
normal
);
done_cb
();
return
;
}
auto
&
mbox_cache
=
m_mailbox
.
cache
();
auto
mbox_end
=
mbox_cache
.
end
();
auto
rm_fun
=
[
this
](
queue_node_ptr
&
ptr
)
{
return
handle_message
(
*
ptr
);
};
/*auto rm_fun = [=](queue_node_ptr& ptr) -> bool
{
CPPA_REQUIRE(ptr.get() != nullptr);
return handle_message(*ptr);
};*/
try
{
for
(;;)
...
...
@@ -143,12 +154,8 @@ void abstract_event_based_actor::resume(util::fiber*, resume_callback* callback)
}
m_mailbox_pos
=
m_mailbox
.
try_fetch_more
();
}
m_mailbox_pos
=
std
::
find_if
(
m_mailbox_pos
,
mbox_end
,
rm_fun
);
if
(
m_mailbox_pos
!=
mbox_end
)
{
mbox_cache
.
erase
(
m_mailbox_pos
);
m_mailbox_pos
=
mbox_cache
.
begin
();
}
m_mailbox_pos
=
(
invoke_from_cache
())
?
mbox_cache
.
begin
()
:
mbox_cache
.
end
();
}
}
catch
(
actor_exited
&
what
)
...
...
src/abstract_scheduled_actor.cpp
View file @
d967328b
...
...
@@ -144,6 +144,7 @@ void abstract_scheduled_actor::request_timeout(util::duration const& d)
auto
abstract_scheduled_actor
::
filter_msg
(
any_tuple
const
&
msg
)
->
filter_result
{
CPPA_REQUIRE
(
msg
.
cvals
().
get
()
!=
nullptr
);
if
(
msg
.
size
()
==
2
&&
msg
.
type_at
(
0
)
==
t_atom_ui32_types
[
0
]
&&
msg
.
type_at
(
1
)
==
t_atom_ui32_types
[
1
])
...
...
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