Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove unused type definitions.
[simgrid.git] / src / simgrid / Exception.cpp
1 /* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include <simgrid/Exception.hpp>
7
8 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
9
10 namespace simgrid {
11
12 ForcefulKillException::~ForcefulKillException() = default;
13
14 void ForcefulKillException::do_throw()
15 {
16   throw ForcefulKillException();
17 }
18
19 bool ForcefulKillException::try_n_catch(const std::function<void()>& try_block)
20 {
21   bool res;
22   try {
23     try_block();
24     res = true;
25   } catch (ForcefulKillException const&) {
26     XBT_DEBUG("Caught a ForcefulKillException");
27     res = false;
28   }
29   return res;
30 }
31 } // namespace simgrid