aboutsummaryrefslogtreecommitdiffstats
path: root/include/gqueue/gqueue.h
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-06-10 17:18:01 +1000
committerinmarket <andrewh@inmarket.com.au>2013-06-10 17:18:01 +1000
commit2cb35d6815a0a12035f4792c266b688c77085620 (patch)
tree292ebc4760767d67b41f7f0e0022185afcf05067 /include/gqueue/gqueue.h
parent777ec6af7c1b594f7b7a9cbaaf7ead90d8fb7e8f (diff)
downloaduGFX-2cb35d6815a0a12035f4792c266b688c77085620.tar.gz
uGFX-2cb35d6815a0a12035f4792c266b688c77085620.tar.bz2
uGFX-2cb35d6815a0a12035f4792c266b688c77085620.zip
Clean up GWIN Event assignment. Optimise event efficiency.
Diffstat (limited to 'include/gqueue/gqueue.h')
-rw-r--r--include/gqueue/gqueue.h44
1 files changed, 42 insertions, 2 deletions
diff --git a/include/gqueue/gqueue.h b/include/gqueue/gqueue.h
index 38c1908d..399042d9 100644
--- a/include/gqueue/gqueue.h
+++ b/include/gqueue/gqueue.h
@@ -103,7 +103,7 @@ void gfxQueueFSyncInit(gfxQueueFSync *pqueue);
/* @} */
/**
- * @brief Get an item from the head of the queue.
+ * @brief Get an item from the head of the queue (and remove it from the queue).
* @return NULL if the timeout expires before an item is available
*
* @param[in] pqueue A pointer to the queue
@@ -139,7 +139,7 @@ bool_t gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delayti
/* @} */
/**
- * @brief Pop an item from the head of the queue.
+ * @brief Pop an item from the head of the queue (and remove it from the queue).
* @detail This is exactly the same as the Get operation above.
*
* @api
@@ -220,6 +220,46 @@ bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem);
bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem);
/* @} */
+/**
+ * @brief Get the first item from the head of the queue but do not remove it from the queue.
+ * @return NULL if no item is available.
+ *
+ * @param[in] pqueue A pointer to the queue
+ *
+ * @note This call does not block.
+ * @note This can be used as the first call to iterate all the elements in the queue.
+ * @note As that item is still on the queue, it should be treated as read-only. It could
+ * also be removed from the queue at any time by another thread (thereby altering the
+ * queue item).
+ *
+ * @api
+ * @{
+ */
+#define gfxQueueASyncPeek(pqueue) ((const gfxQueueASyncItem *)((pqueue)->head))
+#define gfxQueueGSyncPeek(pqueue) ((const gfxQueueGSyncItem *)((pqueue)->head))
+#define gfxQueueFSyncPeek(pqueue) ((const gfxQueueFSyncItem *)((pqueue)->head))
+/* @} */
+
+/**
+ * @brief Get the next item in the queue (but do not remove it from the queue).
+ * @return NULL if no item is available.
+ *
+ * @param[in] pitem The previous item in the queue
+ *
+ * @note This call does not block.
+ * @note This can be used as subsequent calls to iterate all the elements in the queue.
+ * @note As that item is still on the queue, it should be treated as read-only. It could
+ * also be removed from the queue at any time by another thread (thereby altering the
+ * queue item).
+ *
+ * @api
+ * @{
+ */
+#define gfxQueueASyncNext(pitem) ((const gfxQueueASyncItem *)((pitem)->next))
+#define gfxQueueGSyncNext(pitem) ((const gfxQueueGSyncItem *)((pitem)->next))
+#define gfxQueueFSyncNext(pitem) ((const gfxQueueFSyncItem *)((pitem)->next))
+/* @} */
+
#ifdef __cplusplus
}
#endif