mirror of https://gitee.com/bigwinds/arangodb
Specialize scheduler pointer to allow devirtualization of method calls (#9225)
This commit is contained in:
parent
51254758f8
commit
f4baf0c436
|
@ -65,7 +65,7 @@ size_t defaultNumberOfThreads() {
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
|
|
||||||
Scheduler* SchedulerFeature::SCHEDULER = nullptr;
|
SupervisedScheduler* SchedulerFeature::SCHEDULER = nullptr;
|
||||||
|
|
||||||
SchedulerFeature::SchedulerFeature(application_features::ApplicationServer& server)
|
SchedulerFeature::SchedulerFeature(application_features::ApplicationServer& server)
|
||||||
: ApplicationFeature(server, "Scheduler"),
|
: ApplicationFeature(server, "Scheduler"),
|
||||||
|
@ -162,19 +162,21 @@ void SchedulerFeature::validateOptions(std::shared_ptr<options::ProgramOptions>)
|
||||||
void SchedulerFeature::prepare() {
|
void SchedulerFeature::prepare() {
|
||||||
TRI_ASSERT(2 <= _nrMinimalThreads);
|
TRI_ASSERT(2 <= _nrMinimalThreads);
|
||||||
TRI_ASSERT(_nrMinimalThreads <= _nrMaximalThreads);
|
TRI_ASSERT(_nrMinimalThreads <= _nrMaximalThreads);
|
||||||
|
// wait for windows fix or implement operator new
|
||||||
//wait for windows fix or implement operator new
|
|
||||||
#if (_MSC_VER >= 1)
|
#if (_MSC_VER >= 1)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4316) // Object allocated on the heap may not be aligned for this type
|
#pragma warning(disable : 4316) // Object allocated on the heap may not be aligned for this type
|
||||||
#endif
|
#endif
|
||||||
_scheduler =
|
auto sched =
|
||||||
std::make_unique<SupervisedScheduler>(_nrMinimalThreads, _nrMaximalThreads,
|
std::make_unique<SupervisedScheduler>(_nrMinimalThreads, _nrMaximalThreads,
|
||||||
_queueSize, _fifo1Size, _fifo2Size);
|
_queueSize, _fifo1Size, _fifo2Size);
|
||||||
#if (_MSC_VER >= 1)
|
#if (_MSC_VER >= 1)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
SCHEDULER = _scheduler.get();
|
|
||||||
|
SCHEDULER = sched.get();
|
||||||
|
|
||||||
|
_scheduler = std::move(sched);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerFeature::start() {
|
void SchedulerFeature::start() {
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
#include "ApplicationFeatures/ApplicationFeature.h"
|
#include "ApplicationFeatures/ApplicationFeature.h"
|
||||||
#include "GeneralServer/Socket.h" // This is required for asio_ns::signal_set
|
#include "GeneralServer/Socket.h" // This is required for asio_ns::signal_set
|
||||||
#include "Scheduler/Scheduler.h"
|
#include "Scheduler/Scheduler.h"
|
||||||
|
#include "Scheduler/SupervisedScheduler.h"
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
|
|
||||||
class SchedulerFeature final : public application_features::ApplicationFeature {
|
class SchedulerFeature final : public application_features::ApplicationFeature {
|
||||||
public:
|
public:
|
||||||
static Scheduler* SCHEDULER;
|
static SupervisedScheduler* SCHEDULER;
|
||||||
|
|
||||||
explicit SchedulerFeature(application_features::ApplicationServer& server);
|
explicit SchedulerFeature(application_features::ApplicationServer& server);
|
||||||
~SchedulerFeature();
|
~SchedulerFeature();
|
||||||
|
|
|
@ -78,7 +78,7 @@ class ClusterCommTester : public ClusterComm {
|
||||||
somethingReceived.broadcast();
|
somethingReceived.broadcast();
|
||||||
} // signalResponse
|
} // signalResponse
|
||||||
|
|
||||||
Scheduler* _oldSched;
|
decltype(SchedulerFeature::SCHEDULER) _oldSched;
|
||||||
SupervisedScheduler _testerSched;
|
SupervisedScheduler _testerSched;
|
||||||
|
|
||||||
}; // class ClusterCommTester
|
}; // class ClusterCommTester
|
||||||
|
|
Loading…
Reference in New Issue