source: lib/data-struct/object_cache.h @ 6e41e73

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 6e41e73 was 6e41e73, checked in by Richard Sanger <rsangerarj@…>, 6 years ago

Fixes bug where packets could be destroyed by unregistered threads
We now destroy the packet object cache thread caches before unresistering a thread

Also includes some whitespace fixes.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#ifndef LIBTRACE_OBJECT_CACHE_H
2#define LIBTRACE_OBJECT_CACHE_H
3
4#include "ring_buffer.h"
5#include "vector.h"
6
7
8struct local_cache;
9typedef struct libtrace_ocache {
10        libtrace_ringbuffer_t rb;
11        void *(*alloc)(void);
12        void (*free)(void *);
13        size_t thread_cache_size;
14        size_t max_allocations;
15        size_t current_allocations;
16        pthread_spinlock_t spin;
17        size_t nb_thread_list;
18        size_t max_nb_thread_list;
19        struct local_cache **thread_list;
20} libtrace_ocache_t;
21
22DLLEXPORT void libtrace_ocache_init(libtrace_ocache_t *oc, void *(*alloc)(void), void (*free)(void*),
23                                    size_t thread_cache_size, size_t buffer_size, bool limit_size);
24DLLEXPORT int libtrace_ocache_destroy(libtrace_ocache_t *oc);
25DLLEXPORT size_t libtrace_ocache_alloc(libtrace_ocache_t *oc, void *values[], size_t nb_buffers, size_t min_nb_buffers);
26DLLEXPORT size_t libtrace_ocache_free(libtrace_ocache_t *oc, void *values[], size_t nb_buffers, size_t min_nb_buffers);
27DLLEXPORT void libtrace_zero_ocache(libtrace_ocache_t *oc);
28DLLEXPORT void libtrace_ocache_unregister_thread(libtrace_ocache_t *oc);
29#endif // LIBTRACE_OBJECT_CACHE_H
Note: See TracBrowser for help on using the repository browser.