![]() * Internal function to backoff on contention. Static inline void lfq_init(struct lfq *q, size_t queue_size, * Initialize a struct lfq with a size and array of memory. * Licensed under the 3 clause BSD license. The code below is what I came up with – it’s a blocking, single producer, single consumer lock-free ring buffer FIFO queue. It also had to avoid calling the allocator at any point. In circular buffer there are pointers which are used by the system to put in the data and remove the data. The code had to be low overhead enough to ensure that it wouldn’t obscure the performance characteristics of the code being benchmarked, so I was looking for a data structure that was lock-free and reasonably simple and fast. It works on the principle of FIFO (First in First Out). Recently I was looking for some code to pass buffers between two threads in a memory allocator benchmark. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |