Displaying 5 results from an estimated 5 matches for "connected_callback".
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...oop
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <assert.h>
+
+#include <libnbd.h>
+
+#include <glib.h>
+
+struct NBDSource;
+typedef void (*connecting_callback_t) (struct NBDSource *);
+typedef void (*connected_callback_t) (struct NBDSource *);
+
+/* This is the derived GSource type. */
+struct NBDSource {
+ /* The base type. This MUST be the first element in this struct. */
+ GSource source;
+
+ /* The underlying libnbd handle. */
+ struct nbd_handle *nbd;
+ bool debug; /* true if handle h...
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...o.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <assert.h>
+
+#include <libnbd.h>
+
+#include <glib.h>
+
+struct NBDSource;
+typedef void (*connecting_callback_t) (struct NBDSource *);
+typedef void (*connected_callback_t) (struct NBDSource *);
+
+/* This is the derived GSource type. */
+struct NBDSource {
+ /* The base type. This MUST be the first element in this struct. */
+ GSource source;
+
+ /* The underlying libnbd handle. */
+ struct nbd_handle *nbd;
+ bool debug; /* true if handle h...
2019 Jul 17
2
[PATCH libnbd v2] examples: Include an example of integrating with glib main loop.
This is working now, and incorporates all of the changes in Eric's
review, *except* that it still doesn't retire commands (although this
seems to make no obvious difference, except possibly a performance and
memory impact).
Rich.
2019 Jul 15
2
[PATCH libnbd] examples: Include an example of integrating with the glibc main loop.
** NOT WORKING **
This patch shows how to integrate libnbd and the glib main loop.
Posted mainly as a point of discussion as it doesn't quite work yet.
Rich.
2019 Jul 17
1
Re: [PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...gt; + gsdest = create_libnbd_gsource (dest);
> + loopctx = g_main_loop_get_context (loop);
> + g_source_attach ((GSource *) gssrc, loopctx);
> + g_source_attach ((GSource *) gsdest, loopctx);
> +
> + /* Make sure we get called back when each handle connects. */
> + gssrc->connected_callback = connected;
> + gsdest->connected_callback = connected;
> +
> + /* Asynchronously start each handle connecting. */
> + if (nbd_aio_connect_command (src, (char **) src_args) == -1) {
> + fprintf (stderr, "%s\n", nbd_get_error ());
> + exit (EXIT_FAILURE);
>...