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
98e2a20a
Commit
98e2a20a
authored
May 16, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parallelized connection establishments
parent
ac81fea9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
37 deletions
+42
-37
benchmarks/distributed.cpp
benchmarks/distributed.cpp
+42
-37
No files found.
benchmarks/distributed.cpp
View file @
98e2a20a
...
@@ -296,52 +296,57 @@ void client_mode(Iterator first, Iterator last) {
...
@@ -296,52 +296,57 @@ void client_mode(Iterator first, Iterator last) {
for
(
size_t
j
=
0
;
j
<
remotes
.
size
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
remotes
.
size
();
++
j
)
{
if
(
i
!=
j
)
{
if
(
i
!=
j
)
{
auto
&
r
=
remotes
[
j
];
auto
&
r
=
remotes
[
j
];
send
(
remote_actors
[
i
],
send
(
remote_actors
[
i
],
atom
(
"add_pong"
),
r
.
first
,
r
.
second
);
atom
(
"add_pong"
),
r
.
first
,
r
.
second
);
receive
(
on
(
atom
(
"ok"
))
>>
[]()
{
},
on
(
atom
(
"error"
),
arg_match
)
>>
[
&
](
string
const
&
str
)
{
cout
<<
"error on node "
<<
i
<<
": "
<<
str
<<
endl
;
for
(
auto
&
x
:
remote_actors
)
{
send
(
x
,
atom
(
"purge"
));
}
throw
std
::
logic_error
(
""
);
},
others
()
>>
[]()
{
cout
<<
"expected {ok|error}, received: "
<<
to_string
(
self
->
last_dequeued
())
<<
endl
;
throw
std
::
logic_error
(
""
);
},
after
(
std
::
chrono
::
seconds
(
10
))
>>
[
&
]()
{
cout
<<
"remote didn't answer within 10sec."
<<
endl
;
for
(
auto
&
x
:
remote_actors
)
{
send
(
x
,
atom
(
"purge"
));
}
throw
std
::
logic_error
(
""
);
}
);
}
}
}
}
}
}
{
// collect {ok} messages
size_t
i
=
0
;
size_t
end
=
remote_actors
.
size
()
*
(
remote_actors
.
size
()
-
1
);
receive_for
(
i
,
end
)
(
on
(
atom
(
"ok"
))
>>
[]()
{
},
on
(
atom
(
"error"
),
arg_match
)
>>
[
&
](
string
const
&
str
)
{
cout
<<
"error: "
<<
str
<<
endl
;
for
(
auto
&
x
:
remote_actors
)
{
send
(
x
,
atom
(
"purge"
));
}
throw
std
::
logic_error
(
""
);
},
others
()
>>
[]()
{
cout
<<
"expected {ok|error}, received: "
<<
to_string
(
self
->
last_dequeued
())
<<
endl
;
throw
std
::
logic_error
(
""
);
},
after
(
std
::
chrono
::
seconds
(
10
))
>>
[
&
]()
{
cout
<<
"remote didn't answer within 10sec."
<<
endl
;
for
(
auto
&
x
:
remote_actors
)
{
send
(
x
,
atom
(
"purge"
));
}
throw
std
::
logic_error
(
""
);
}
);
}
// kickoff
// kickoff
//cout << "setup done" << endl;
//cout << "setup done" << endl;
//cout << "kickoff, init value = " << init_value << endl;
//cout << "kickoff, init value = " << init_value << endl;
for
(
auto
&
r
:
remote_actors
)
{
for
(
auto
&
r
:
remote_actors
)
{
send
(
r
,
atom
(
"kickoff"
),
init_value
);
send
(
r
,
atom
(
"kickoff"
),
init_value
);
}
}
size_t
i
=
0
;
{
// collect {done} messages
size_t
num_pings
=
remote_actors
.
size
()
*
(
remote_actors
.
size
()
-
1
);
size_t
i
=
0
;
receive_for
(
i
,
num_pings
)
(
size_t
end
=
remote_actors
.
size
()
*
(
remote_actors
.
size
()
-
1
);
on
(
atom
(
"done"
))
>>
[]()
{
receive_for
(
i
,
end
)
(
//cout << "...done..." << endl;
on
(
atom
(
"done"
))
>>
[]()
{
},
//cout << "...done..." << endl;
others
()
>>
[]()
{
},
cout
<<
"unexpected: "
<<
to_string
(
self
->
last_dequeued
())
<<
endl
;
others
()
>>
[]()
{
throw
std
::
logic_error
(
""
);
cout
<<
"unexpected: "
<<
to_string
(
self
->
last_dequeued
())
<<
endl
;
}
throw
std
::
logic_error
(
""
);
);
}
);
}
await_all_others_done
();
await_all_others_done
();
}
}
...
...
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