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
1bc73535
Commit
1bc73535
authored
Jan 25, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fsm_actor in cppa.hpp
parent
f6042822
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
cppa/cppa.hpp
cppa/cppa.hpp
+1
-0
examples/dining_philosophers.cpp
examples/dining_philosophers.cpp
+5
-4
No files found.
cppa/cppa.hpp
View file @
1bc73535
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include "cppa/scheduler.hpp"
#include "cppa/scheduler.hpp"
#include "cppa/to_string.hpp"
#include "cppa/to_string.hpp"
#include "cppa/any_tuple.hpp"
#include "cppa/any_tuple.hpp"
#include "cppa/fsm_actor.hpp"
#include "cppa/local_actor.hpp"
#include "cppa/local_actor.hpp"
#include "cppa/exit_reason.hpp"
#include "cppa/exit_reason.hpp"
#include "cppa/invoke_rules.hpp"
#include "cppa/invoke_rules.hpp"
...
...
examples/dining_philosophers.cpp
View file @
1bc73535
...
@@ -30,11 +30,10 @@
...
@@ -30,11 +30,10 @@
#include <vector>
#include <vector>
#include <chrono>
#include <chrono>
#include <iostream>
#include <sstream>
#include <sstream>
#include <iostream>
#include "cppa/cppa.hpp"
#include "cppa/cppa.hpp"
#include "cppa/fsm_actor.hpp"
using
std
::
cout
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
endl
;
...
@@ -133,6 +132,8 @@ struct philosopher : fsm_actor<philosopher>
...
@@ -133,6 +132,8 @@ struct philosopher : fsm_actor<philosopher>
(
(
on
(
atom
(
"taken"
),
what
)
>>
[
=
]()
on
(
atom
(
"taken"
),
what
)
>>
[
=
]()
{
{
// create message in memory to avoid interleaved
// messages on the terminal
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
name
oss
<<
name
<<
" has picked up chopsticks with IDs "
<<
" has picked up chopsticks with IDs "
...
@@ -198,7 +199,7 @@ struct philosopher : fsm_actor<philosopher>
...
@@ -198,7 +199,7 @@ struct philosopher : fsm_actor<philosopher>
become
(
&
thinking
);
become
(
&
thinking
);
}
}
);
);
// philosopher obtained both chopstic
s
k and eats (for five seconds)
// philosopher obtained both chopstick and eats (for five seconds)
eating
=
eating
=
(
(
on
(
atom
(
"think"
))
>>
[
=
]()
on
(
atom
(
"think"
))
>>
[
=
]()
...
@@ -225,7 +226,7 @@ struct philosopher : fsm_actor<philosopher>
...
@@ -225,7 +226,7 @@ struct philosopher : fsm_actor<philosopher>
};
};
int
main
()
int
main
(
int
,
char
**
)
{
{
// create five chopsticks
// create five chopsticks
cout
<<
"chopstick ids:"
;
cout
<<
"chopstick ids:"
;
...
...
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