All Projects → Taymindis → lfqueue

Taymindis / lfqueue

Licence: BSD-2-Clause license
lock-free FIFO queue by C native built it, easy built cross platform(no extra dependencies needed) , guarantee thread safety memory management ever!

Programming Languages

c
50402 projects - #5 most used programming language
CMake
9771 projects
shell
77523 projects

Projects that are alternatives of or similar to lfqueue

lfqueue
Minimize lock-free queue ever!
Stars: ✭ 107 (+2.88%)
Mutual labels:  lock-free, thread-safety, wait-free, lock-free-queue
Jctools
jctools.github.io/jctools
Stars: ✭ 2,833 (+2624.04%)
Mutual labels:  lock-free, wait-free
concurrent-resource
A header-only C++ library that allows easily creating thread-safe, concurrency friendly resources.
Stars: ✭ 17 (-83.65%)
Mutual labels:  threadsafe, thread-safety
sled
A high performance lock free map type for go.
Stars: ✭ 18 (-82.69%)
Mutual labels:  lock-free, thread-safety
lock-free-queue
CN-CppUserGroup-2019-1,lock-free queue demo
Stars: ✭ 58 (-44.23%)
Mutual labels:  lock-free, lock-free-queue
hatrack
Fast, multi-reader, multi-writer, lockless data structures for parallel programming
Stars: ✭ 55 (-47.12%)
Mutual labels:  lock-free, wait-free
database-all
Eloquent ORM for Java 【database-spring-boot-starter】
Stars: ✭ 151 (+45.19%)
Mutual labels:  threadsafe
HJSynchronizeDemo
No description or website provided.
Stars: ✭ 14 (-86.54%)
Mutual labels:  threadsafe
Nonblocking
Implementation of a lock-free dictionary on .Net.
Stars: ✭ 237 (+127.88%)
Mutual labels:  lock-free
Xenium
A C++ library providing various concurrent data structures and reclamation schemes.
Stars: ✭ 225 (+116.35%)
Mutual labels:  lock-free
zedis
A tiny embedded, lock free, redis-like, pub+sub, brokerless, key value datastore. ømq+sled
Stars: ✭ 33 (-68.27%)
Mutual labels:  lock-free
send wrapper
No description or website provided.
Stars: ✭ 39 (-62.5%)
Mutual labels:  thread-safety
Realm Cocoa
Realm is a mobile database: a replacement for Core Data & SQLite
Stars: ✭ 14,778 (+14109.62%)
Mutual labels:  threadsafe
selenium-auto-wait
Utility to automatically manage all web element waits and enables to write wait-free selenium tests.
Stars: ✭ 31 (-70.19%)
Mutual labels:  wait-free
lockfree
⚡️ lock-free utilities in Go
Stars: ✭ 109 (+4.81%)
Mutual labels:  lock-free
Ringbuf
Lock-free ring buffer (MPSC)
Stars: ✭ 227 (+118.27%)
Mutual labels:  lock-free
Golang Set
A simple set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp.
Stars: ✭ 2,168 (+1984.62%)
Mutual labels:  threadsafe
concurrent-ll
concurrent linked list implementation
Stars: ✭ 66 (-36.54%)
Mutual labels:  lock-free
Transmittable Thread Local
📌 TransmittableThreadLocal (TTL), the missing Java™ std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
Stars: ✭ 4,678 (+4398.08%)
Mutual labels:  threadsafe
eventbus
A threadsafe C++ implementation of the EventBus idiom
Stars: ✭ 27 (-74.04%)
Mutual labels:  threadsafe

lfqueue Build Status

lock-free FIFO queue by C native built it, easy built cross platform(no extra dependencies needed) , guarantee thread safety memory management ever!

All Platform tests

GCC/CLANG | Build Status

VS x64/x86 | Build status

API

extern int   lfqueue_init(lfqueue_t *lfqueue);
extern int   lfqueue_enq(lfqueue_t *lfqueue, void *value);
extern void* lfqueue_deq(lfqueue_t *lfqueue);
extern void* lfqueue_single_deq(lfqueue_t *lfqueue);
extern void lfqueue_destroy(lfqueue_t *lfqueue);
extern size_t lfqueue_size(lfqueue_t *lfqueue);
extern void lfqueue_sleep(unsigned int milisec);

Example

int* int_data;
lfqueue_t my_queue;

if (lfqueue_init(&my_queue) == -1)
	return -1;

/** Wrap This scope in other threads **/
int_data = (int*) malloc(sizeof(int));
assert(int_data != NULL);
*int_data = i++;
/*Enqueue*/
 while (lfqueue_enq(&my_queue, int_data) == -1) {
    printf("ENQ Full ?\n");
}

/** Wrap This scope in other threads **/
/*Dequeue*/
while  ( (int_data = lfqueue_deq(&my_queue)) == NULL) {
    printf("DEQ EMPTY ..\n");
}

// printf("%d\n", *(int*) int_data );
free(int_data);
/** End **/

lfqueue_destroy(&my_queue);

If you are using single thread dequeue/consume. Please use lfqueue_single_deq to get better result

Build and Installation

For linux OS, you may use cmake build, for other platforms, please kindly include the source code and header file into the project, e.g. VS2017, DEV-C++, Xcode

mkdir build

cd build

cmake ..

make

./lfqueue-example

valgrind --tool=memcheck --leak-check=full ./lfqueue-example

sudo make install

continuously Test

For continuously test until N number, if you having any issue while testing, please kindly raise an issue

./keep-testing.sh

Uninstallation

cd build

sudo make uninstall

You may also like lock free stack LIFO

lfstack

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].