Displaying 2 results from an estimated 2 matches for "buffer_unused".
2019 Jul 30
0
[PATCH libnbd] examples: Fix theoretical cookie race in example.
...;buffers[i], so the callback no longer needs to search the list of
buffers (this is also quicker).
This necessitated another change however: previously we were copying
buffers around to ensure that the next free buffer was always at
&buffers[nr_buffers]. Instead of that introduce a new state
(BUFFER_UNUSED) and search the short list of buffers once when looking
for a free buffer.
Thanks: Eric Blake.
---
examples/glib-main-loop.c | 96 +++++++++++++--------------------------
1 file changed, 32 insertions(+), 64 deletions(-)
diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c
index 9f...
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.