blob: efffaf51e17bf5a78a5f440d3e7b3420175dfafb [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
2 * Copyright (c) 2019, Infosys Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef PROCEDUREQUEUE_H_
18#define PROCEDUREQUEUE_H_
19
20#include <queue>
21#include <mutex>
22#include <semaphore.h>
23
24using namespace std;
25
26namespace SM
27{
28
29class ControlBlock;
30
31class ProcedureQueue
32{
33 public:
34 ProcedureQueue();
35 ~ProcedureQueue();
36
37 ControlBlock* pop();
38 bool push(ControlBlock* cb);
39
40 private:
41 queue <ControlBlock*> cbQ;
42 std::mutex mutex_m;
43 sem_t pop_semaphore;
44};
45}
46#endif /* PROCEDUREQUEUE_H_ */