X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2c174f6e9fa13eef2a2d2ef3a2895ca366084fd5..d1977b62d98f448de19f108f3a5bb49b1f2eee54:/doc/doxygen/inside_extending.doc diff --git a/doc/doxygen/inside_extending.doc b/doc/doxygen/inside_extending.doc index 0ea39405ca..a0a8a97856 100644 --- a/doc/doxygen/inside_extending.doc +++ b/doc/doxygen/inside_extending.doc @@ -211,11 +211,12 @@ with the result: try { std::vector result = simgrid::simix::kernelSync([&] { // Fictional example, simgrid::kernel::readFile does not exist. - simgrid::Future> result = simgrid::kernel::readFile(file); + simgrid::kernel::Future> result = simgrid::kernel::readFile(file); return result; }); XBT_DEBUG("Finished reading file %s: length %zu", file, result.size()); } +// If the operation failed, kernelSync() throws an exception: catch (std::runtime_error& e) { XBT_ERROR("Could not read file %s", file); } @@ -228,7 +229,7 @@ like `kernelSync()` but does not block. Instead, it returns a ~~~ simgrid::simix::Future> result = simgrid::simix::kernelSync([&] { // Fictional example, simgrid::kernel::readFile does not exist. - simgrid::Future> result = simgrid::kernel::readFile(file); + simgrid::kernek::Future> result = simgrid::kernel::readFile(file); return result; }; @@ -239,9 +240,10 @@ while (!result.is_ready() && hasWorkToDo()) // We don't have anything to do, wait for the operation to complete and // get its value: try { - std:vector value = result.get(); - XBT_DEBUG("Finished reading file %s: length %zu", file, result.size()); + std:vector data = result.get(); + XBT_DEBUG("Finished reading file %s: length %zu", file, data.size()); } +// If the operation failed, .get() throws an exception: catch (std::runtime_error& e) { XBT_ERROR("Could not read file %s", file); }