search for: reader_paused

Displaying 7 results from an estimated 7 matches for "reader_paused".

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.
...ED, > + BUFFER_WRITING, > +}; > + > +struct buffer { > + uint64_t offset; > + int64_t cookie; > + enum buffer_state state; > + char *data; > +}; > + > +static struct buffer buffers[MAX_BUFFERS]; > +static size_t nr_buffers; > + > +static bool finished, reader_paused; > + > +static GMainLoop *loop; > + > +static void connected (struct NBDSource *source); > +static gboolean read_data (gpointer user_data); > +static int finished_read (void *vp, int64_t cookie, int *error); > +static gboolean write_data (gpointer user_data); > +static int f...
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...65536 + +enum buffer_state { + BUFFER_READING, + BUFFER_READ_COMPLETED, + BUFFER_WRITING, +}; + +struct buffer { + uint64_t offset; + int64_t cookie; + enum buffer_state state; + char *data; +}; + +static struct buffer buffers[MAX_BUFFERS]; +static size_t nr_buffers; + +static bool finished, reader_paused; + +static GMainLoop *loop; + +static void connected (struct NBDSource *source); +static gboolean read_data (gpointer user_data); +static int finished_read (void *vp, int64_t cookie, int *error); +static gboolean write_data (gpointer user_data); +static int finished_write (void *vp, int64_t cookie,...
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...pleted commands + * in the buffer table by cookie we must maintain separate read and + * write cookies. + */ + int64_t rcookie; + int64_t wcookie; + enum buffer_state state; + char *data; +}; + +static struct buffer buffers[MAX_BUFFERS]; +static size_t nr_buffers; + +static bool finished, reader_paused; + +static GMainLoop *loop; + +static void connected (struct NBDSource *source); +static gboolean read_data (gpointer user_data); +static int finished_read (void *vp, int64_t rcookie, int *error); +static gboolean write_data (gpointer user_data); +static int finished_write (void *vp, int64_t wcooki...
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 30
0
[PATCH libnbd] examples: Fix theoretical cookie race in example.
...read requests are in flight, return FALSE so this * idle callback is unregistered. It will be registered by the * write callback when nr_buffers decreases. */ - if (nr_buffers >= MAX_BUFFERS) { - DEBUG (gssrc, "read_data: buffer full, pausing reads from source"); - reader_paused = true; - return FALSE; - } + assert (nr_buffers == MAX_BUFFERS); + DEBUG (gssrc, "read_data: buffer full, pausing reads from source"); + reader_paused = true; + return FALSE; + found: /* Begin reading into the new buffer. */ assert (buffers[i].data == NULL); buffers[i]...
2019 Jul 30
4
[PATCH libnbd] examples: Fix theoretical cookie race in example.
Previously discussed here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html It turns out that deferring callbacks is a PITA. (It would be a bit easier if C has closures.) However by rewriting the example we can avoid the need to use the cookie at all and make it run a bit more efficiently, so let's do that instead. Rich.