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) {
provides a safe and exception-safe way to hold locks in Qore, only to be used on the stack,...
Definition: QoreThreadLock.h:136
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
a thread condition class implementing a wrapper for pthread_cond_t
Definition: QoreCondition.h:45
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:60
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
provides a mutually-exclusive thread lock
Definition: QoreThreadLock.h:49
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275
DLLEXPORT void discard(ExceptionSink *xsink)
dereferences any contained AbstractQoreNode pointer and sets to 0; does not modify other values