to a location that guarantees the buffer has been mapped by the daemon
Fixes a race.
- if(found) {
- buffers_to_export--;
- }
- else {
ERR("channel not found (%s)", channel_and_cpu);
}
ERR("channel not found (%s)", channel_and_cpu);
}
list_add(&bc->list, &blocked_consumers);
list_add(&bc->list, &blocked_consumers);
+ /* Being here is the proof the daemon has mapped the buffer in its
+ * memory. We may now decrement buffers_to_export.
+ */
+ if(atomic_long_read(&buf->consumed) == 0) {
+ DBG("decrementing buffers_to_export");
+ buffers_to_export--;
+ }
+