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
b8168356
Commit
b8168356
authored
Mar 17, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more refactoring
parent
6f113f7c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
20 deletions
+38
-20
Makefile.rules
Makefile.rules
+2
-2
cppa/actor.hpp
cppa/actor.hpp
+1
-1
cppa/match.hpp
cppa/match.hpp
+0
-1
cppa/message_queue.hpp
cppa/message_queue.hpp
+2
-1
src/mock_scheduler.cpp
src/mock_scheduler.cpp
+6
-1
unit_testing/test__local_group.cpp
unit_testing/test__local_group.cpp
+27
-14
No files found.
Makefile.rules
View file @
b8168356
CXX
=
/opt/local/bin/g++-mp-4.5
CXX
=
/opt/local/bin/g++-mp-4.5
#
CXXFLAGS = -std=c++0x -pedantic -Wall -Wextra -O2 -I/opt/local/include/
CXXFLAGS
=
-std
=
c++0x
-pedantic
-Wall
-Wextra
-O2
-I
/opt/local/include/
CXXFLAGS
=
-std
=
c++0x
-pedantic
-Wall
-Wextra
-g
-O0
-I
/opt/local/include/
#
CXXFLAGS = -std=c++0x -pedantic -Wall -Wextra -g -O0 -I/opt/local/include/
LIBS
=
-L
/opt/local/lib
-lboost_thread-mt
LIBS
=
-L
/opt/local/lib
-lboost_thread-mt
cppa/actor.hpp
View file @
b8168356
...
@@ -10,7 +10,7 @@ class actor : public channel
...
@@ -10,7 +10,7 @@ class actor : public channel
public:
public:
virtual
void
link
(
const
intrusive_ptr
<
actor
>&
other
)
=
0
;
virtual
void
link
_to
(
const
intrusive_ptr
<
actor
>&
other
)
=
0
;
};
};
...
...
cppa/match.hpp
View file @
b8168356
...
@@ -53,7 +53,6 @@ bool match(const untyped_tuple& what, const ValuesTuple& vals,
...
@@ -53,7 +53,6 @@ bool match(const untyped_tuple& what, const ValuesTuple& vals,
std
::
vector
<
std
::
size_t
>
tmp
(
mappings
);
std
::
vector
<
std
::
size_t
>
tmp
(
mappings
);
view_type
view
(
what
.
vals
(),
std
::
move
(
tmp
));
view_type
view
(
what
.
vals
(),
std
::
move
(
tmp
));
return
compare_first_elements
(
view
,
vals
);
return
compare_first_elements
(
view
,
vals
);
// return view == vals;
}
}
return
false
;
return
false
;
}
}
...
...
cppa/message_queue.hpp
View file @
b8168356
...
@@ -8,11 +8,12 @@ namespace cppa { class invoke_rules; }
...
@@ -8,11 +8,12 @@ namespace cppa { class invoke_rules; }
namespace
cppa
{
namespace
cppa
{
class
message_queue
:
public
channel
class
message_queue
{
{
public:
public:
virtual
void
enqueue
(
const
message
&
)
=
0
;
virtual
const
message
&
dequeue
()
=
0
;
virtual
const
message
&
dequeue
()
=
0
;
virtual
void
dequeue
(
invoke_rules
&
)
=
0
;
virtual
void
dequeue
(
invoke_rules
&
)
=
0
;
virtual
bool
try_dequeue
(
message
&
)
=
0
;
virtual
bool
try_dequeue
(
message
&
)
=
0
;
...
...
src/mock_scheduler.cpp
View file @
b8168356
...
@@ -106,7 +106,7 @@ struct actor_impl : context
...
@@ -106,7 +106,7 @@ struct actor_impl : context
m_mbox
.
enqueue
(
msg
);
m_mbox
.
enqueue
(
msg
);
}
}
virtual
void
link
(
const
intrusive_ptr
<
actor
>&
)
{
}
virtual
void
link
_to
(
const
intrusive_ptr
<
actor
>&
)
{
}
virtual
void
unlink
(
const
intrusive_ptr
<
actor
>&
)
{
}
virtual
void
unlink
(
const
intrusive_ptr
<
actor
>&
)
{
}
...
@@ -128,6 +128,11 @@ boost::condition_variable m_ra_cv;
...
@@ -128,6 +128,11 @@ boost::condition_variable m_ra_cv;
void
run_actor_impl
(
intrusive_ptr
<
actor_impl
>
m_impl
)
void
run_actor_impl
(
intrusive_ptr
<
actor_impl
>
m_impl
)
{
{
{
actor_impl
*
self_ptr
=
m_impl
.
get
();
self_ptr
->
ref
();
m_this_context
.
reset
(
self_ptr
);
}
actor_behavior
*
ab
=
m_impl
->
m_behavior
;
actor_behavior
*
ab
=
m_impl
->
m_behavior
;
if
(
ab
)
if
(
ab
)
{
{
...
...
unit_testing/test__local_group.cpp
View file @
b8168356
...
@@ -103,7 +103,7 @@ class local_group : public group
...
@@ -103,7 +103,7 @@ class local_group : public group
//local_group* m_local_group = new local_group;
//local_group* m_local_group = new local_group;
intrusive_ptr
<
local_group
>
m_local_group
;
intrusive_ptr
<
local_group
>
m_local_group
(
new
local_group
)
;
intrusive_ptr
<
local_group
>
local
(
const
char
*
)
intrusive_ptr
<
local_group
>
local
(
const
char
*
)
{
{
...
@@ -138,10 +138,22 @@ struct storage
...
@@ -138,10 +138,22 @@ struct storage
};
};
void
foo_actor_ptr
(
)
void
consumer
(
actor_ptr
main_actor
)
{
{
receive
(
on
<
int
>
()
>>
[](
int
i
)
{
int
result
=
0
;
reply
(
i
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
receive
(
on
<
int
>
()
>>
[
&
](
int
x
)
{
result
+=
x
;
});
}
send
(
main_actor
,
result
);
}
void
producer
(
actor_ptr
consume_actor
)
{
receive
(
on
<
int
>
()
>>
[
&
](
int
i
)
{
send
(
consume_actor
,
i
);
});
});
}
}
...
@@ -152,24 +164,25 @@ std::size_t test__local_group()
...
@@ -152,24 +164,25 @@ std::size_t test__local_group()
std
::
list
<
intrusive_ptr
<
group
::
subscription
>>
m_subscriptions
;
std
::
list
<
intrusive_ptr
<
group
::
subscription
>>
m_subscriptions
;
auto
self_ptr
=
self
();
auto
consume_actor
=
spawn
([
=
]()
{
consumer
(
self_ptr
);
});
auto
lg
=
local
(
"foobar"
);
auto
lg
=
local
(
"foobar"
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
{
m_subscriptions
.
push_back
(
lg
->
subscribe
(
spawn
(
foo_actor_ptr
)));
auto
fa
=
spawn
([
=
]()
{
producer
(
consume_actor
);
});
auto
sptr
=
lg
->
subscribe
(
fa
);
m_subscriptions
.
push_back
(
sptr
);
}
}
send
(
lg
,
1
);
send
(
lg
,
1
);
int
result
=
0
;
await_all_actors_done
()
;
for
(
int
i
=
0
;
i
<
5
;
++
i
)
receive
(
on
<
int
>
()
>>
[
&
](
int
x
)
{
{
CPPA_CHECK_EQUAL
(
x
,
5
);
receive
(
on
<
int
>
()
>>
[
&
result
](
int
x
)
{
result
+=
x
;
});
});
}
CPPA_CHECK_EQUAL
(
result
,
5
);
return
CPPA_TEST_RESULT
;
return
CPPA_TEST_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