Resource Tuner
Loading...
Searching...
No Matches
SignalQueue.h
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause-Clear
3
4#ifndef SIGNAL_QUEUE_H
5#define SIGNAL_QUEUE_H
6
7#include "Utils.h"
8#include "Signal.h"
9#include "OrderedQueue.h"
10#include "ExtFeaturesRegistry.h"
11#include "ResourceRegistry.h"
12#include "ServerInternal.h"
13
19class SignalQueue : public OrderedQueue {
20private:
21 static std::shared_ptr<SignalQueue> mSignalQueueInstance;
22 static std::mutex instanceProtectionLock;
23
25
26public:
28
30
31 static std::shared_ptr<SignalQueue> getInstance() {
32 if(mSignalQueueInstance == nullptr) {
33 instanceProtectionLock.lock();
34 if(mSignalQueueInstance == nullptr) {
35 try {
36 mSignalQueueInstance = std::shared_ptr<SignalQueue> (new SignalQueue());
37 } catch(const std::bad_alloc& e) {
38 instanceProtectionLock.unlock();
39 return nullptr;
40 }
41 }
42 instanceProtectionLock.unlock();
43 }
44 return mSignalQueueInstance;
45 }
46};
47
48#endif
This class represents a mutex-protected multiple producer, single consumer priority queue.
This class represents a mutex-protected multiple producer, single consumer priority queue.
Definition SignalQueue.h:19
void orderedQueueConsumerHook()
Provides a mechanism, to hook or plug-in the Consumer Code.