#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/lease_mgr.h>
#include <dhcpsrv/lease_mgr_factory.h>
+#include <dhcpsrv/multi_threading_utils.h>
#include <dhcpsrv/subnet_id.h>
#include <hooks/hooks.h>
#include <exceptions/exceptions.h>
return (0);
}
+// Using a critical section to avoid any changes in parallel.
+
int
StatCmds::statLease4GetHandler(CalloutHandle& handle) {
LeaseStatCmdsImpl impl;
+ MultiThreadingCriticalSection sc;
return(impl.statLease4GetHandler(handle));
}
int
StatCmds::statLease6GetHandler(CalloutHandle& handle) {
LeaseStatCmdsImpl impl;
+ MultiThreadingCriticalSection sc;
return(impl.statLease6GetHandler(handle));
}
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@section stat_cmdsMTCompatibility Multi-Threading Compatibility
-The Stat Commands Hook library currently reports it is not
-compatible with multi-threading. This will be revisited as there is
-no essential reason for such uncompatibility.
+The Stat Commands Hook library reports it is compatible with
+multi-threading. All commands are executed inside a critical section,
+i.e. with threads stopped. It makes sense to not have lease state
+changes when taking lease counts.
*/
/// @brief This function is called to know the multi-threading compatibility.
///
-/// @note: this should be revisited as the library is not essentially
-/// uncompatible.
-///
-/// @return 0 which means not compatible with multi-threading.
+/// @return 1 which means compatible with multi-threading.
int multi_threading_compatible() {
- return (0);
+ return (1);
}
} // end extern "C"