forest-net
an overlay networks for large-scale virtual worlds
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Queue.h
Go to the documentation of this file.
1
9
#ifndef QUEUE_H
10
#define QUEUE_H
11
12
#include <pthread.h>
13
#include "stdinc.h"
14
#include "Util.h"
15
16
namespace
forest {
17
18
22
class
Queue
{
23
public
:
Queue
(
int
=10);
24
~
Queue
();
25
bool
init();
26
void
reset
();
27
28
bool
empty
()
const
;
29
30
void
enq
(
int
);
31
int
deq
();
32
int
deq
(uint32_t);
33
static
int
const
TIMEOUT = (1 << 31);
// largest 32 bit negative number
34
private
:
35
int
qMax
;
36
37
int
count
;
38
int
head
;
39
int
tail
;
40
41
int
*
buf
;
42
43
pthread_mutex_t
lock
;
44
pthread_cond_t
emptyQ
;
45
pthread_cond_t
fullQ
;
46
};
47
51
inline
bool
Queue::empty
()
const
{
return
count
== 0; }
52
53
}
// ends namespace
54
55
56
#endif
forest-net
cpp
include
Queue.h
Generated on Mon Aug 4 2014 11:13:35 for forest-net by
1.8.4