repo.or.cz
/
dolphin.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Windows: Link debug build against debug wiiuse. Can't keep linking to the release...
[dolphin.git]
/
Source
/
Core
/
DolphinWX
/
Src
/
LockingQueue.h
blob
39750916981ea5fea3e8591177f64ddcc39f9a32
1
#ifndef _LOCKINGQUEUE_H_
2
#define _LOCKINGQUEUE_H_
3
4
#include
"Thread.h"
5
#include <queue>
6
7
// i should make one of those single reader/ single writer queues
8
9
template
<
typename T
>
10
class
LockingQueue
11
{
12
public
:
13
size_t
Size
()
14
{
15
m_crit
.
Enter
();
16
const size_t
s
=
m_queue
.
size
();
17
m_crit
.
Leave
();
18
return
s
;
19
}
20
21
void
Push
(
const
T
&
t
)
22
{
23
m_crit
.
Enter
();
24
m_queue
.
push
(
t
);
25
m_crit
.
Leave
();
26
}
27
28
bool
Pop
(
T
&
t
)
29
{
30
m_crit
.
Enter
();
31
if
(
m_queue
.
size
())
32
{
33
t
=
m_queue
.
front
();
34
m_queue
.
pop
();
35
m_crit
.
Leave
();
36
return true
;
37
}
38
m_crit
.
Leave
();
39
return false
;
40
}
41
42
private
:
43
std
::
queue
<
T
>
m_queue
;
44
Common
::
CriticalSection m_crit
;
45
};
46
47
#endif