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
c05472d2
Commit
c05472d2
authored
Apr 20, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored channel interface
parent
e3526dee
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
42 deletions
+24
-42
cppa/actor.hpp
cppa/actor.hpp
+7
-0
cppa/actor_proxy.hpp
cppa/actor_proxy.hpp
+2
-5
cppa/channel.hpp
cppa/channel.hpp
+1
-3
cppa/detail/abstract_scheduled_actor.hpp
cppa/detail/abstract_scheduled_actor.hpp
+1
-6
cppa/detail/addressed_message.hpp
cppa/detail/addressed_message.hpp
+0
-2
cppa/detail/converted_thread_context.hpp
cppa/detail/converted_thread_context.hpp
+1
-3
src/actor.cpp
src/actor.cpp
+6
-0
src/actor_proxy.cpp
src/actor_proxy.cpp
+4
-10
src/converted_thread_context.cpp
src/converted_thread_context.cpp
+1
-6
src/group_manager.cpp
src/group_manager.cpp
+1
-7
No files found.
cppa/actor.hpp
View file @
c05472d2
...
@@ -59,6 +59,13 @@ class actor : public channel
...
@@ -59,6 +59,13 @@ class actor : public channel
~
actor
();
~
actor
();
/**
* @brief Enqueues @p msg to the actor's mailbox and returns true if
* this actor is an scheduled actor that successfully changed
* its state to @p pending.
*/
virtual
bool
pending_enqueue
(
actor
*
sender
,
any_tuple
msg
);
/**
/**
* @brief Attaches @p ptr to this actor.
* @brief Attaches @p ptr to this actor.
*
*
...
...
cppa/actor_proxy.hpp
View file @
c05472d2
...
@@ -54,9 +54,7 @@ class actor_proxy : public abstract_actor<actor>
...
@@ -54,9 +54,7 @@ class actor_proxy : public abstract_actor<actor>
actor_proxy
(
std
::
uint32_t
mid
,
process_information_ptr
const
&
parent
);
actor_proxy
(
std
::
uint32_t
mid
,
process_information_ptr
const
&
parent
);
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
);
void
enqueue
(
actor
*
sender
,
any_tuple
msg
);
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
);
void
link_to
(
intrusive_ptr
<
actor
>&
other
);
void
link_to
(
intrusive_ptr
<
actor
>&
other
);
...
@@ -76,8 +74,7 @@ class actor_proxy : public abstract_actor<actor>
...
@@ -76,8 +74,7 @@ class actor_proxy : public abstract_actor<actor>
public:
public:
void
forward_message
(
process_information_ptr
const
&
,
void
forward_message
(
process_information_ptr
const
&
,
actor
*
,
any_tuple
&&
);
actor
*
,
any_tuple
const
&
);
};
};
...
...
cppa/channel.hpp
View file @
c05472d2
...
@@ -60,9 +60,7 @@ class channel : public ref_counted
...
@@ -60,9 +60,7 @@ class channel : public ref_counted
/**
/**
* @brief Enqueues @p msg to the list of received messages.
* @brief Enqueues @p msg to the list of received messages.
*/
*/
virtual
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
)
=
0
;
virtual
void
enqueue
(
actor
*
sender
,
any_tuple
msg
)
=
0
;
virtual
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
=
0
;
private:
private:
...
...
cppa/detail/abstract_scheduled_actor.hpp
View file @
c05472d2
...
@@ -139,16 +139,11 @@ class abstract_scheduled_actor : public abstract_actor<scheduled_actor>
...
@@ -139,16 +139,11 @@ class abstract_scheduled_actor : public abstract_actor<scheduled_actor>
throw
actor_exited
(
reason
);
throw
actor_exited
(
reason
);
}
}
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
void
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
{
enqueue_node
(
super
::
fetch_node
(
sender
,
std
::
move
(
msg
)));
enqueue_node
(
super
::
fetch_node
(
sender
,
std
::
move
(
msg
)));
}
}
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
)
{
enqueue_node
(
super
::
fetch_node
(
sender
,
msg
));
}
int
compare_exchange_state
(
int
expected
,
int
new_value
)
int
compare_exchange_state
(
int
expected
,
int
new_value
)
{
{
int
e
=
expected
;
int
e
=
expected
;
...
...
cppa/detail/addressed_message.hpp
View file @
c05472d2
...
@@ -38,8 +38,6 @@
...
@@ -38,8 +38,6 @@
#include "cppa/ref_counted.hpp"
#include "cppa/ref_counted.hpp"
#include "cppa/intrusive_ptr.hpp"
#include "cppa/intrusive_ptr.hpp"
#include "cppa/detail/channel.hpp"
namespace
cppa
{
namespace
detail
{
namespace
cppa
{
namespace
detail
{
class
addressed_message
class
addressed_message
...
...
cppa/detail/converted_thread_context.hpp
View file @
c05472d2
...
@@ -100,9 +100,7 @@ class converted_thread_context : public abstract_actor<local_actor>
...
@@ -100,9 +100,7 @@ class converted_thread_context : public abstract_actor<local_actor>
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
void
enqueue
(
actor
*
sender
,
any_tuple
const
&
msg
);
//override
void
dequeue
(
behavior
&
rules
);
//override
void
dequeue
(
behavior
&
rules
);
//override
...
...
src/actor.cpp
View file @
c05472d2
...
@@ -63,6 +63,12 @@ actor::actor(std::uint32_t aid, const process_information_ptr& pptr)
...
@@ -63,6 +63,12 @@ actor::actor(std::uint32_t aid, const process_information_ptr& pptr)
}
}
}
}
bool
actor
::
pending_enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
enqueue
(
sender
,
std
::
move
(
msg
));
return
false
;
}
actor
::
actor
(
const
process_information_ptr
&
pptr
)
actor
::
actor
(
const
process_information_ptr
&
pptr
)
:
m_id
(
registry
().
next_id
()),
m_is_proxy
(
false
),
m_parent_process
(
pptr
)
:
m_id
(
registry
().
next_id
()),
m_is_proxy
(
false
),
m_parent_process
(
pptr
)
{
{
...
...
src/actor_proxy.cpp
View file @
c05472d2
...
@@ -54,19 +54,13 @@ actor_proxy::actor_proxy(std::uint32_t mid, const process_information_ptr& pptr)
...
@@ -54,19 +54,13 @@ actor_proxy::actor_proxy(std::uint32_t mid, const process_information_ptr& pptr)
void
actor_proxy
::
forward_message
(
const
process_information_ptr
&
piptr
,
void
actor_proxy
::
forward_message
(
const
process_information_ptr
&
piptr
,
actor
*
sender
,
actor
*
sender
,
const
any_tuple
&
msg
)
any_tuple
&
&
msg
)
{
{
auto
mailman_msg
=
new
detail
::
mailman_job
(
piptr
,
sender
,
this
,
msg
);
auto
mailman_msg
=
new
detail
::
mailman_job
(
piptr
,
sender
,
this
,
std
::
move
(
msg
)
);
detail
::
mailman_queue
().
push_back
(
mailman_msg
);
detail
::
mailman_queue
().
push_back
(
mailman_msg
);
}
}
void
actor_proxy
::
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
void
actor_proxy
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
any_tuple
tmp
(
std
::
move
(
msg
));
enqueue
(
sender
,
tmp
);
}
void
actor_proxy
::
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
)
{
{
if
(
msg
.
size
()
==
2
if
(
msg
.
size
()
==
2
&&
*
(
msg
.
type_at
(
0
))
==
typeid
(
atom_value
)
&&
*
(
msg
.
type_at
(
0
))
==
typeid
(
atom_value
)
...
@@ -76,7 +70,7 @@ void actor_proxy::enqueue(actor* sender, const any_tuple& msg)
...
@@ -76,7 +70,7 @@ void actor_proxy::enqueue(actor* sender, const any_tuple& msg)
cleanup
(
msg
.
get_as
<
std
::
uint32_t
>
(
1
));
cleanup
(
msg
.
get_as
<
std
::
uint32_t
>
(
1
));
return
;
return
;
}
}
forward_message
(
parent_process_ptr
(),
sender
,
msg
);
forward_message
(
parent_process_ptr
(),
sender
,
std
::
move
(
msg
)
);
}
}
void
actor_proxy
::
link_to
(
intrusive_ptr
<
actor
>&
other
)
void
actor_proxy
::
link_to
(
intrusive_ptr
<
actor
>&
other
)
...
...
src/converted_thread_context.cpp
View file @
c05472d2
...
@@ -59,16 +59,11 @@ void converted_thread_context::cleanup(std::uint32_t reason)
...
@@ -59,16 +59,11 @@ void converted_thread_context::cleanup(std::uint32_t reason)
super
::
cleanup
(
reason
);
super
::
cleanup
(
reason
);
}
}
void
converted_thread_context
::
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
void
converted_thread_context
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
{
m_mailbox
.
push_back
(
fetch_node
(
sender
,
std
::
move
(
msg
)));
m_mailbox
.
push_back
(
fetch_node
(
sender
,
std
::
move
(
msg
)));
}
}
void
converted_thread_context
::
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
)
{
m_mailbox
.
push_back
(
fetch_node
(
sender
,
msg
));
}
void
converted_thread_context
::
dequeue
(
partial_function
&
fun
)
// override
void
converted_thread_context
::
dequeue
(
partial_function
&
fun
)
// override
{
{
if
(
m_invoke
.
invoke_from_cache
(
fun
)
==
false
)
if
(
m_invoke
.
invoke_from_cache
(
fun
)
==
false
)
...
...
src/group_manager.cpp
View file @
c05472d2
...
@@ -60,7 +60,7 @@ class group_impl : public group
...
@@ -60,7 +60,7 @@ class group_impl : public group
public:
public:
void
enqueue
(
actor
*
sender
,
const
any_tuple
&
msg
)
/*override*/
void
enqueue
(
actor
*
sender
,
any_tuple
msg
)
/*override*/
{
{
shared_guard
guard
(
m_shared_mtx
);
shared_guard
guard
(
m_shared_mtx
);
for
(
auto
i
=
m_subscribers
.
begin
();
i
!=
m_subscribers
.
end
();
++
i
)
for
(
auto
i
=
m_subscribers
.
begin
();
i
!=
m_subscribers
.
end
();
++
i
)
...
@@ -71,12 +71,6 @@ class group_impl : public group
...
@@ -71,12 +71,6 @@ class group_impl : public group
}
}
}
}
void
enqueue
(
actor
*
sender
,
any_tuple
&&
msg
)
/*override*/
{
any_tuple
tmp
(
std
::
move
(
msg
));
enqueue
(
sender
,
tmp
);
}
group
::
subscription
subscribe
(
const
channel_ptr
&
who
)
/*override*/
group
::
subscription
subscribe
(
const
channel_ptr
&
who
)
/*override*/
{
{
group
::
subscription
result
;
group
::
subscription
result
;
...
...
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