Changeset 6e41e73 for lib/data-struct/object_cache.c
- Timestamp:
- 11/27/14 14:19:19 (8 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- d7fd648
- Parents:
- 21f5f0f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/data-struct/object_cache.c
r78911b5 r6e41e73 1 2 1 #include "object_cache.h" 3 2 #include <assert.h> … … 34 33 35 34 /** 36 * @brief free_arrayassumes we DONT hold spin35 * @brief unregister_thread assumes we DONT hold spin 37 36 */ 38 37 static inline void unregister_thread(struct local_cache *lc) { … … 71 70 72 71 /** 73 * @brief free_array assumes we hold spin!!!72 * @brief register_thread assumes we DONT hold spin 74 73 */ 75 74 static inline void register_thread(libtrace_ocache_t *oc, struct local_cache *lc) { … … 429 428 } 430 429 430 /** 431 * @brief ocache_unregister_thread removes a thread from an ocache. 432 * @param The ocache to remove this thread, this will free any packets in the TLS cache 433 */ 434 DLLEXPORT void libtrace_ocache_unregister_thread(libtrace_ocache_t *oc) { 435 size_t i; 436 struct local_cache *lc = find_cache(oc); 437 438 if (lc) { 439 for (i = 0; i < t_mem_caches_used; ++i) { 440 if (&t_mem_caches[i] == lc) { 441 // Free the cache against the ocache 442 unregister_thread(&t_mem_caches[i]); 443 free(t_mem_caches[i].cache); 444 // And remove it from the thread itself 445 --t_mem_caches_used; 446 t_mem_caches[i] = t_mem_caches[t_mem_caches_used]; 447 memset(&t_mem_caches[t_mem_caches_used], 0, sizeof(struct local_cache)); 448 } 449 } 450 } 451 }
Note: See TracChangeset
for help on using the changeset viewer.