mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-capture: add clear/reset API for mapped ring buffer
This commit is contained in:
@ -621,3 +621,25 @@ mapped_ring_buffer_create_source (MappedRingBuffer *self,
|
|||||||
{
|
{
|
||||||
return mapped_ring_buffer_create_source_full (self, source_func, user_data, NULL);
|
return mapped_ring_buffer_create_source_full (self, source_func, user_data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mapped_ring_buffer_clear:
|
||||||
|
* @self: a #MappedRingBuffer
|
||||||
|
*
|
||||||
|
* Resets the head and tail positions back to 0.
|
||||||
|
*
|
||||||
|
* This function is only safe to call when you control both the reader
|
||||||
|
* and writer sides with mapped_ring_buffer_new_readwrite(), or are in
|
||||||
|
* control of when each side reads or writes.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mapped_ring_buffer_clear (MappedRingBuffer *self)
|
||||||
|
{
|
||||||
|
MappedRingHeader *header;
|
||||||
|
|
||||||
|
g_return_if_fail (self != NULL);
|
||||||
|
|
||||||
|
header = get_header (self);
|
||||||
|
header->head = 0;
|
||||||
|
header->tail = 0;
|
||||||
|
}
|
||||||
|
|||||||
@ -66,6 +66,8 @@ MappedRingBuffer *mapped_ring_buffer_ref (MappedRingBuffer
|
|||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void mapped_ring_buffer_unref (MappedRingBuffer *self);
|
void mapped_ring_buffer_unref (MappedRingBuffer *self);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
|
void mapped_ring_buffer_clear (MappedRingBuffer *self);
|
||||||
|
G_GNUC_INTERNAL
|
||||||
gpointer mapped_ring_buffer_allocate (MappedRingBuffer *self,
|
gpointer mapped_ring_buffer_allocate (MappedRingBuffer *self,
|
||||||
gsize length);
|
gsize length);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
|
|||||||
Reference in New Issue
Block a user