From 1d26348bb013552326c394ac69033ff3323e18e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Fri, 4 Dec 2015 22:18:29 +0100 Subject: [PATCH] iomux_signal.h and wqueue.h should be usable in C++. Add to IOMux doxygen group too. --- include/ucore/iomux_signal.h | 15 +++++++++++++++ include/ucore/wqueue.h | 37 +++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/include/ucore/iomux_signal.h b/include/ucore/iomux_signal.h index 43e014b..05e18d6 100644 --- a/include/ucore/iomux_signal.h +++ b/include/ucore/iomux_signal.h @@ -2,6 +2,15 @@ #define UC_IOMUX_SIGNAL_H_ #include "ucore/iomux.h" + +/** @addtogroup IOMux + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + /** Callback signature for handling unix signals. * @param mux associated mux * @param signo unix signal number @@ -45,4 +54,10 @@ int iomux_register_unixsignal(struct IOMux *mux, */ int iomux_unregister_unixsignal(struct IOMux *mux, int signo); +#ifdef __cplusplus +} +#endif + +/** @} (addtogroup)*/ + #endif diff --git a/include/ucore/wqueue.h b/include/ucore/wqueue.h index 3a460dd..d34a7bc 100644 --- a/include/ucore/wqueue.h +++ b/include/ucore/wqueue.h @@ -4,6 +4,17 @@ #include "mbuf.h" #include "iomux.h" +/** @addtogroup IOMux + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Return code from users write callback + */ enum UC_WQ_RESULT { /** INdicates the MBuf was fully processed and can be freed*/ UC_WQ_DONE = 1, @@ -51,15 +62,33 @@ typedef enum UC_WQ_RESULT (*wqueue_write_cb)(struct IOMux *mux, struct IOMuxFD * */ typedef enum UC_WQ_RESULT (*wqueue_read_cb)(struct IOMux *mux, struct IOMuxFD *fd); -/** Represents a queue of data to write. +/** + * Represents a queue of data to write. + * UCWQueue replaces a raw IOMuxFD, and manages a queue + * of data to write, held as a list of struct MBuf. + * See also uc_wqueue_init + * */ struct UCWQueue { + /** Underlying IOMuxFD. This member needs to be registered + * with an IOMux, see the description of uc_wqueue_init + */ struct IOMuxFD fd; + /** Linked list of struct MBuf + */ struct TailQ queue; + /** Associated mux + */ struct IOMux *mux; + /** Users callback for read events + */ wqueue_read_cb read_cb; + /** Users callback for write events + */ wqueue_write_cb write_cb; + /** Current number of queued struct MBuf + */ unsigned int queue_len; }; @@ -120,4 +149,10 @@ int uc_wqueue_enqueue(struct UCWQueue *wqueue, struct MBuf *mbuf); */ int uc_wqueue_flush(struct UCWQueue *wqueue); +#ifdef __cplusplus +} +#endif + +/** @} (addtogroup)*/ + #endif