32 #ifndef _QORE_QOREQUEUEINTERN_H
34 #define _QORE_QOREQUEUEINTERN_H
36 #include <qore/QoreThreadLock.h>
37 #include <qore/QoreCondition.h>
41 class qore_object_private;
49 DLLLOCAL QoreQueueNode(
QoreValue n, QoreQueueNode* p, QoreQueueNode* nx) : node(n), prev(p), next(nx) {
53 DLLLOCAL ~QoreQueueNode() {
81 class qore_queue_private {
82 friend class qore_object_private;
85 enum queue_status_e { Queue_Deleted = -1 };
96 unsigned read_waiting,
102 DLLLOCAL
int waitReadIntern(
ExceptionSink *xsink,
int timeout_ms);
103 DLLLOCAL
int waitWriteIntern(
ExceptionSink *xsink,
int timeout_ms);
112 DLLLOCAL
int checkWriteIntern(
ExceptionSink* xsink,
bool always_error =
false);
115 DLLLOCAL qore_queue_private(
int n_max = -1) : head(0), tail(0), desc(0), len(0), max(n_max), read_waiting(0), write_waiting(0) {
120 DLLLOCAL qore_queue_private(
const qore_queue_private &orig) : head(0), tail(0), err(orig.err), desc(orig.desc ? orig.desc->stringRefSelf() : 0), len(0), max(orig.max), read_waiting(0), write_waiting(0) {
122 if (orig.len == Queue_Deleted)
125 QoreQueueNode* w = orig.head;
127 pushIntern(w->node.refSelf());
136 DLLLOCAL ~qore_queue_private() {
141 assert(len == Queue_Deleted);
146 DLLLOCAL
void pushAndTakeRef(
QoreValue n);
157 DLLLOCAL
bool empty()
const {
161 DLLLOCAL
int size()
const {
165 DLLLOCAL
int getMax()
const {
169 DLLLOCAL
unsigned getReadWaiting()
const {
173 DLLLOCAL
unsigned getWriteWaiting()
const {
174 return write_waiting;
182 DLLLOCAL
void clearError();
184 DLLLOCAL
bool scanMembers(RObject& obj, RSetHelper& rsh);
186 DLLLOCAL
static void destructor(QoreQueue& q,
ExceptionSink* xsink) {
187 q.priv->destructor(xsink);
190 DLLLOCAL
static qore_queue_private* get(QoreQueue& q) {
195 #endif // _QORE_QOREQUEUEINTERN_H