-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPool.cpp
More file actions
38 lines (34 loc) · 701 Bytes
/
Pool.cpp
File metadata and controls
38 lines (34 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Pool.cpp
* Task.cpp
*
* Created by mru on 26/12/11.
* Copyright 2011 tid. All rights reserved.
*
*/
#include "Pool.h"
#include <iostream>
#include <ostream>
#include <sstream>
template <class MyTypeData>
Task<MyTypeData> Pool<MyTypeData>::pop() {
Task<MyTypeData> taskPopped;
mux.lock();
if (!qeue.empty()) {
taskPopped = qeue.front();
qeue.pop_front();
}
mux.unlock();
return taskPopped;
};
template <class MyTypeData>
void Pool<MyTypeData>::push(Task<MyTypeData> task) {
mux.lock();
qeue.push_front(task);
mux.unlock();
};
template <class MyTypeData>
bool Pool<MyTypeData>::empty() {
bool r = qeue.empty();
return r;
};