Copyright (c) 2012-2013, Magnus Edenhill, et.al.
https://github.com/edenhill/librd
librd aims to provide the commonly needed helpers, sub systems, snippets and misc. functionality that lacks from the standard C libraries, allowing for rapid development of new programs and non-intrusive extension of existing applications.
librd is non-intrusive in the sense that single specific functionality from librd can be used by the application without having to use or initialize other parts of the library. In its most simple form you add -lrd -lz -lrt
to your linking step and include the proper rd<FUNC>.h
include file for your desired functionality.
librd is licensed under the 2-clause BSD license.
librd provides, on a higher level:
Non-exhaustive list of current librd functionality:
rdqueue.h
: Thread-safe FIFO queues (nice for worker queues).rdthread.h
: Thread management abstraction.rdmem.h
: Memory contexts for contextual malloc's allowing memory usage supervision and free-all-context-memory-at-once.rdmem.h
: Efficient memory and allocation helpers: `rd_calloc_rdsysqueue.h
: Improved sys/queue.hrdopt.h
: Short (-c) and long (--config) command line argument option parsing with input validation and automatic variable assignments.rdfloat.h
: Float comparison helpers.rdaddr.h
: AF_INET
and AF_INET6
agnostification.rdbuf.h
: Generic buffers with (de)serializer/writer/reader callbacks.rdstring.h
: String helpers: rd_strnchrs()
.rd.h
: Convenience macros and porting alleviation: RD_CAP*(), RD_ARRAY_SIZE(), RD_ARRAY_ELEM(), RD_MIN(), RD_MAX()
.rdavl.h
: Thread-safe AVL trees.rdio.h
: Socket/fd IO abstraction and helpers.rdfile.h
: File/filesystem access helpers.rdencoding.h
: Various encoder and decoder helpers (varint).The GNU toolchain
pthreads
zlib
make all
make install
# or to install in another location than /usr/local:
DESTDIR=/my/prefix make install
The above procedure continues on test failures, but that might not be desirable, so here's how to do make sure the tests pass before installing.
#include <librd/rd.h>
#include <librd/rdFUNCTIONALITY.h>
...
rd_init();
...
rd_....();
Link your program with -lrd -lz -lrt
.
Documentation is still lacking, but each public function and concept is described in its .h
header file while internal functions are described in their .c
files.
Regression tests are integrated into the build process. The tests are in the tests/
sub-directory.
The test programs in the tests/
sub-directory serve as examples, but some more explicit examples will be provided in the examples/
sub-directory.
More documentation and usage examples will come.
NOTE: The Kafka implementation has been moved to its own library. See librdkafka.
Public projects using librdScattered lists of things to do:
obj->ll = rd_ll_add(mylist, obj);
rd_workers_create(..., rd_conf_getu32("sys.cpu.cores") * 16);
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4