aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsclient/inbound.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-04 19:19:22 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-04 19:19:22 +0200
commit266004dea7e489246a0234769d26c93d17a19780 (patch)
treea6d437906f63aa1f23e72a59b7e6983cc233f60c /src/libmdsclient/inbound.h
parentm + prototypes for message spooling and pooling (diff)
downloadmds-266004dea7e489246a0234769d26c93d17a19780.tar.gz
mds-266004dea7e489246a0234769d26c93d17a19780.tar.bz2
mds-266004dea7e489246a0234769d26c93d17a19780.tar.xz
implement message spool and pool
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/libmdsclient/inbound.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/libmdsclient/inbound.h b/src/libmdsclient/inbound.h
index 7682b54..05fcc74 100644
--- a/src/libmdsclient/inbound.h
+++ b/src/libmdsclient/inbound.h
@@ -210,7 +210,7 @@ typedef struct libmds_mpool
*
* @param this Memory slot in which to store the new message
* @return Zero on success, -1 error, `errno` will be set
- * accordingly. Destroy the message on error.
+ * accordingly
*
* @throws ENOMEM Out of memory. Possibly, the process hit the RLIMIT_AS or
* RLIMIT_DATA limit described in getrlimit(2).
@@ -267,6 +267,9 @@ int libmds_message_read(libmds_message_t* restrict this, int fd);
*
* @param this The message spool
* @return Zero on success, -1 on error, `errno` will be set accordingly
+ *
+ * @throws ENOMEM Out of memory. Possibly, the process hit the RLIMIT_AS or
+ * RLIMIT_DATA limit described in getrlimit(2).
*/
__attribute__((nonnull, warn_unused_result))
int libmds_mspool_initialise(libmds_mspool_t* restrict this);
@@ -283,8 +286,12 @@ void libmds_mspool_destroy(libmds_mspool_t* restrict this);
* Spool a message
*
* @param this The message spool
- * @param message The message to spool
+ * @param message The message to spool, must be flat (created with `libmds_message_duplicate`)
* @return Zero on success, -1 on error, `errno` will be set accordingly
+ *
+ * @throws EINTR If interrupted
+ * @throws ENOMEM Out of memory. Possibly, the process hit the RLIMIT_AS or
+ * RLIMIT_DATA limit described in getrlimit(2).
*/
__attribute__((nonnull, warn_unused_result))
int libmds_mspool_spool(libmds_mspool_t* restrict this, libmds_message_t* restrict message);
@@ -294,6 +301,8 @@ int libmds_mspool_spool(libmds_mspool_t* restrict this, libmds_message_t* restri
*
* @param this The message spool
* @return A spooled message, `NULL`on error, `errno` will be set accordingly
+ *
+ * @throws EINTR If interrupted
*/
__attribute__((nonnull, warn_unused_result, malloc))
libmds_message_t* libmds_mspool_poll(libmds_mspool_t* restrict this);
@@ -306,9 +315,15 @@ libmds_message_t* libmds_mspool_poll(libmds_mspool_t* restrict this);
* @param deadline The CLOCK_REALTIME time the function must return,
* `NULL` to return immediately if it would block
* @return A spooled message, `NULL`on error, `errno` will be set accordingly
+ *
+ * @throws EINTR If interrupted
+ * @throws EAGAIN If `deadline` is `NULL` and the spool is empty
+ * @throws EINVAL If `deadline->tv_nsecs` is outside [0, 1 milliard[
+ * @throws ETIMEDOUT If the time specified `deadline` passed and the spool was till empty
*/
__attribute__((nonnull(1), warn_unused_result, malloc))
-libmds_message_t* libmds_mspool_poll_try(libmds_mspool_t* restrict this, const struct timespec* deadline);
+libmds_message_t* libmds_mspool_poll_try(libmds_mspool_t* restrict this,
+ const struct timespec* restrict deadline);
@@ -335,7 +350,9 @@ void libmds_mpool_destroy(libmds_mpool_t* restrict this);
* Add a message allocation to a pool
*
* @param this The message allocation pool
- * @param message Message allocation to pool
+ * @param message Message allocation to pool, must be flat (created with
+ * `libmds_message_duplicate` or fetched with `libmds_mspool_poll`
+ * or `libmds_mspool_poll_try`)
* @return Zero on success, -1 on error, `errno` will be set accordingly
*/
__attribute__((nonnull, warn_unused_result))