icinga2/lib/base/initialize.cpp
Julian Brost 61285adcae InitializeOnceHelper: use std::function instead of C function pointer
InitializeOnceHelper calls Loader::AddDeferredInitializer which takes a
std::function, so it's eventually converted to that anyways. This commit just
does this a bit earlier, and by saving the step of the intermediate C function
pointer, this would now also work for capturing lambdas (which there are none
of at the moment).
2023-01-18 15:52:42 +01:00

13 lines
283 B
C++

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#include "base/initialize.hpp"
#include "base/loader.hpp"
using namespace icinga;
bool icinga::InitializeOnceHelper(const std::function<void()>& func, int priority)
{
Loader::AddDeferredInitializer(func, priority);
return true;
}