| 332 | } |
| 333 | |
| 334 | void Device::execute(std::function<void()>&& f, SyncMode sync) |
| 335 | { |
| 336 | try |
| 337 | { |
| 338 | f(); |
| 339 | } |
| 340 | catch (...) |
| 341 | { |
| 342 | // Make sure to synchronize even if an exception has been thrown |
| 343 | syncAndThrow(sync); |
| 344 | throw; |
| 345 | } |
| 346 | |
| 347 | syncAndThrow(sync); |
| 348 | } |
| 349 | |
| 350 | void Device::waitAndThrow() |
| 351 | { |
no outgoing calls