Loading...
Searching...
No Matches
stdthread.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
#ifndef DUNE_COMMON_STDTHREAD_HH
#define DUNE_COMMON_STDTHREAD_HH
namespace Dune
{
// used internally by assertCallOnce for the actual check
void doAssertCallOnce(const char *file, int line, const char *function);
inline void assertCallOnce(const char *file = nullptr, int line = -1,
const char *function = nullptr)
{
// make sure to call this only the first time this function is invoked
[[maybe_unused]] static const bool works
= (doAssertCallOnce(file, line, function), true);
}
#define DUNE_ASSERT_CALL_ONCE() \
::Dune::assertCallOnce(__FILE__, __LINE__, __func__)
} // namespace Dune
#endif // DUNE_COMMON_STDTHREAD_HH
Dune
Dune namespace
Definition alignedallocator.hh:13
Dune::assertCallOnce
void assertCallOnce(const char *file=nullptr, int line=-1, const char *function=nullptr)
Make sure call_once() works and provide a helpful error message otherwise.
Definition stdthread.hh:35
Dune::doAssertCallOnce
void doAssertCallOnce(const char *file, int line, const char *function)
Definition stdthread.cc:38