Revision fcc1dc1cb3c908a93a2b19283491e65239de5e65 authored by wenqing on 05 September 2023, 09:46:43 UTC, committed by wenqing on 05 September 2023, 09:46:43 UTC
Draft: [MPL] removed phi (1-S_L) from the vapour diffusion model See merge request ogs/ogs!4648
ThreadException.h
/**
* \file
* \copyright
* Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#pragma once
#include <exception>
#include <mutex>
/// Initial code from
/// https://stackoverflow.com/questions/11828539/elegant-exception-handling-in-openmp
class ThreadException
{
public:
void capture()
{
std::unique_lock<std::mutex> guard{lock_};
exception_ = std::current_exception();
}
void rethrow()
{
if (exception_)
{
std::rethrow_exception(exception_);
}
}
private:
std::exception_ptr exception_ = nullptr;
std::mutex lock_;
};
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...