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