aboutsummaryrefslogtreecommitdiffstats
path: root/include/gqueue/gqueue.h
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-07-14 20:02:28 +0200
committerJoel Bodenmann <joel@unormal.org>2013-07-14 20:02:28 +0200
commit38a2a44b3d27ca29019cd0d75e60233ee9188c71 (patch)
tree6cd0e65ba5ce5b0884d5cd4085795e347b5fa509 /include/gqueue/gqueue.h
parentb7e6967886a25277af53e04ce6942b715b538644 (diff)
parentc5ec72027787c9cd5f5b36a46eb55f03fd95d894 (diff)
downloaduGFX-38a2a44b3d27ca29019cd0d75e60233ee9188c71.tar.gz
uGFX-38a2a44b3d27ca29019cd0d75e60233ee9188c71.tar.bz2
uGFX-38a2a44b3d27ca29019cd0d75e60233ee9188c71.zip
Merge branch 'GWIN'
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 0f8f83ea..8ec3c9b9 100644
--- a/include/gqueue/gqueue.h
+++ b/include/gqueue/gqueue.h
@@ -91,7 +91,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
@@ -127,7 +127,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
@@ -208,6 +208,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