From f0fb9bc5f222a157723e57bc4ae4940cc5c7e803 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 15 Jul 2016 17:11:22 +0200 Subject: Add libcoopgamma_set_nonblocking and prototype for libcoopgamma_synchronise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libcoopgamma.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/libcoopgamma.h') diff --git a/src/libcoopgamma.h b/src/libcoopgamma.h index 3f9c935..cef8fc1 100644 --- a/src/libcoopgamma.h +++ b/src/libcoopgamma.h @@ -1207,6 +1207,16 @@ char* libcoopgamma_get_socket_file(const char* restrict, const char* restrict); */ int libcoopgamma_connect(const char* restrict, const char* restrict, libcoopgamma_context_t* restrict); +/** + * By default communication is blocking, this function + * can be used to switch between blocking and nonblocking + * + * @param ctx The state of the library, must be connected + * @param nonblocking Nonblocking mode? + * @return Zero on success, -1 on error + */ +int libcoopgamma_set_nonblocking(libcoopgamma_context_t* restrict, int); + /** * Send all pending outbound data * @@ -1216,11 +1226,31 @@ int libcoopgamma_connect(const char* restrict, const char* restrict, libcoopgamm * be in a properly configured state if a function fails * with EINTR. * - * @param ctx The state of the library, must be initialised + * @param ctx The state of the library, must be connected * @return Zero on success, -1 on error */ int libcoopgamma_flush(libcoopgamma_context_t* restrict); +/** + * Wait for the next message to be received + * + * @param ctx The state of the library, must be connected + * @param pending Information for each pending request + * @param n The number of elements in `pending` + * @param selected The index of the element in `pending` which corresponds + * to the first inbound message, note that this only means + * that the message is not for any of the other request, + * if the message is corrupt any of the listed requests can + * be selected even if it is not for any of the requests. + * Functions that parse the message will detect such corruption. + * @return Zero on success, -1 on error, -2 if the message is ignored + * which happens if corresponding `libcoopgamma_async_context_t` + * is not listed + */ +int libcoopgamma_synchronise(libcoopgamma_context_t* restrict, libcoopgamma_async_context_t* restrict, + size_t, size_t* restrict); + + /** * List all available CRTC:s, send request part * -- cgit v1.2.3-70-g09d2