A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Enable some more test with memcheck, but with disabled leak-check.
[simgrid.git]
/
doc
/
doxygen
/
uhood_switch.doc
diff --git
a/doc/doxygen/uhood_switch.doc
b/doc/doxygen/uhood_switch.doc
index
684eacb
..
123a25d
100644
(file)
--- a/
doc/doxygen/uhood_switch.doc
+++ b/
doc/doxygen/uhood_switch.doc
@@
-200,7
+200,7
@@
The crux of `future.then()` is:
@code{cpp}
template<class T>
template<class F>
@code{cpp}
template<class T>
template<class F>
-auto simgrid::kernel::Future<T>::then
NoU
nwrap(F continuation)
+auto simgrid::kernel::Future<T>::then
_no_u
nwrap(F continuation)
-> Future<decltype(continuation(std::move(*this)))>
{
typedef decltype(continuation(std::move(*this))) R;
-> Future<decltype(continuation(std::move(*this)))>
{
typedef decltype(continuation(std::move(*this))) R;
@@
-468,14
+468,14
@@
kernel which will wake up the actor (with
`simgrid::simix::unblock(actor)`) when the operation is completed.
This is wrapped in a higher-level primitive as well. The
`simgrid::simix::unblock(actor)`) when the operation is completed.
This is wrapped in a higher-level primitive as well. The
-`kernel
S
ync()` function expects a function-object which is executed
+`kernel
_s
ync()` function expects a function-object which is executed
immediately in the simulation kernel and returns a `Future<T>`. The
simulator blocks the actor and resumes it when the `Future<T>` becomes
ready with its result:
@code{cpp}
template<class F>
immediately in the simulation kernel and returns a `Future<T>`. The
simulator blocks the actor and resumes it when the `Future<T>` becomes
ready with its result:
@code{cpp}
template<class F>
-auto kernel
S
ync(F code) -> decltype(code().get())
+auto kernel
_s
ync(F code) -> decltype(code().get())
{
typedef decltype(code().get()) T;
if (SIMIX_is_maestro())
{
typedef decltype(code().get()) T;
if (SIMIX_is_maestro())
@@
-510,7
+510,7
@@
auto kernelSync(F code) -> decltype(code().get())
A contrived example of this would be:
@code{cpp}
A contrived example of this would be:
@code{cpp}
-int res = simgrid::simix::kernel
S
ync([&] {
+int res = simgrid::simix::kernel
_s
ync([&] {
return kernel_wait_until(30).then(
[](simgrid::kernel::Future<void> future) {
return 42;
return kernel_wait_until(30).then(
[](simgrid::kernel::Future<void> future) {
return 42;
@@
-521,7
+521,7
@@
int res = simgrid::simix::kernelSync([&] {
### Asynchronous operations {#uhood_switch_v2_async}
### Asynchronous operations {#uhood_switch_v2_async}
-We can write the related `kernel
A
sync()` which wakes up the actor immediately
+We can write the related `kernel
_a
sync()` which wakes up the actor immediately
and returns a future to the actor. As this future is used in the actor context,
it is a different future
(`simgrid::simix::Future` instead of `simgrid::kernel::Future`)
and returns a future to the actor. As this future is used in the actor context,
it is a different future
(`simgrid::simix::Future` instead of `simgrid::kernel::Future`)
@@
-572,12
+572,12
@@
T simgrid::simix::Future<T>::get()
}
@endcode
}
@endcode
-`kernel
A
sync()` simply :wink: calls `kernelImmediate()` and wraps the
+`kernel
_a
sync()` simply :wink: calls `kernelImmediate()` and wraps the
`simgrid::kernel::Future` into a `simgrid::simix::Future`:
@code{cpp}
template<class F>
`simgrid::kernel::Future` into a `simgrid::simix::Future`:
@code{cpp}
template<class F>
-auto kernel
A
sync(F code)
+auto kernel
_a
sync(F code)
-> Future<decltype(code().get())>
{
typedef decltype(code().get()) T;
-> Future<decltype(code().get())>
{
typedef decltype(code().get()) T;
@@
-594,7
+594,7
@@
auto kernelAsync(F code)
A contrived example of this would be:
@code{cpp}
A contrived example of this would be:
@code{cpp}
-simgrid::simix::Future<int> future = simgrid::simix::kernel
S
ync([&] {
+simgrid::simix::Future<int> future = simgrid::simix::kernel
_s
ync([&] {
return kernel_wait_until(30).then(
[](simgrid::kernel::Future<void> future) {
return 42;
return kernel_wait_until(30).then(
[](simgrid::kernel::Future<void> future) {
return 42;
@@
-605,18
+605,18
@@
do_some_stuff();
int res = future.get();
@endcode
int res = future.get();
@endcode
-`kernel
S
ync()` could be rewritten as:
+`kernel
_s
ync()` could be rewritten as:
@code{cpp}
template<class F>
@code{cpp}
template<class F>
-auto kernel
S
ync(F code) -> decltype(code().get())
+auto kernel
_s
ync(F code) -> decltype(code().get())
{
{
- return kernel
A
sync(std::move(code)).get();
+ return kernel
_a
sync(std::move(code)).get();
}
@endcode
The semantic is equivalent but this form would require two simcalls
}
@endcode
The semantic is equivalent but this form would require two simcalls
-instead of one to do the same job (one in `kernel
A
sync()` and one in
+instead of one to do the same job (one in `kernel
_a
sync()` and one in
`.get()`).
## Mutexes and condition variables
`.get()`).
## Mutexes and condition variables
@@
-769,7
+769,7
@@
We wrote two future implementations based on the `std::future` API:
* the second one is a wait-based (`future.get()`) future used in the actors
which waits using a simcall.
* the second one is a wait-based (`future.get()`) future used in the actors
which waits using a simcall.
-These futures are used to implement `kernel
Sync()` and `kernelA
sync()` which
+These futures are used to implement `kernel
_sync()` and `kernel_a
sync()` which
expose asynchronous operations in the simulation kernel to the actors.
In addition, we wrote variations of some other C++ standard library
expose asynchronous operations in the simulation kernel to the actors.
In addition, we wrote variations of some other C++ standard library
@@
-815,30
+815,14
@@
single-object without shared-state and synchronisation:
@code{cpp}
template<class T>
class Result {
@code{cpp}
template<class T>
class Result {
- enum class ResultStatus {
- invalid,
- value,
- exception,
- };
public:
public:
- Result();
- ~Result();
- Result(Result const& that);
- Result& operator=(Result const& that);
- Result(Result&& that);
- Result& operator=(Result&& that);
bool is_valid() const;
bool is_valid() const;
- void reset();
void set_exception(std::exception_ptr e);
void set_value(T&& value);
void set_value(T const& value);
T get();
private:
void set_exception(std::exception_ptr e);
void set_value(T&& value);
void set_value(T const& value);
T get();
private:
- ResultStatus status_ = ResultStatus::invalid;
- union {
- T value_;
- std::exception_ptr exception_;
- };
+ boost::variant<boost::blank, T, std::exception_ptr> value_;
};
@endcode~
};
@endcode~