projects
/
invirt/third/libt4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean-ups
[invirt/third/libt4.git]
/
rpc
/
fifo.h
diff --git
a/rpc/fifo.h
b/rpc/fifo.h
index
dfb4d05
..
9e4933a
100644
(file)
--- a/
rpc/fifo.h
+++ b/
rpc/fifo.h
@@
-3,7
+3,6
@@
#include "types.h"
#include "types.h"
-// blocks enq() and deq() when queue is FULL or EMPTY
template<class T>
class fifo {
public:
template<class T>
class fifo {
public:
@@
-21,19
+20,15
@@
class fifo {
return true;
}
return true;
}
- void deq(T * e) {
+ T deq() {
lock ml(m_);
while(q_.empty())
non_empty_c_.wait(ml);
lock ml(m_);
while(q_.empty())
non_empty_c_.wait(ml);
- *e = q_.front();
+ T t = q_.front();
q_.pop_front();
if (max_ && q_.size() < max_)
has_space_c_.notify_one();
q_.pop_front();
if (max_ && q_.size() < max_)
has_space_c_.notify_one();
- }
-
- bool size() {
- lock ml(m_);
- return q_.size();
+ return t;
}
private:
}
private: