Rabbit Tree
Radix bit tries for implementing associative arrays and sets in C.
|
#include <pthread.h>
Go to the source code of this file.
Data Structures | |
struct | RBT_NODE_ROOT_T |
Macros | |
#define | RBT_NODE_ROOT_READ(root, func, ...) |
#define | RBT_NODE_ROOT_WRITE(root, func, ...) |
Typedefs | |
typedef struct RBT_NODE_ROOT_T | RBT_NODE_ROOT_T |
Functions | |
RBT_NODE_ROOT_T | RBT_NODE_NEW () |
Create a new root node. More... | |
This file is included automatically by node.h when certain macros are defined. It provides macros and functions for using rabbit trees in a threadsafe way when using pthreads.
#define RBT_NODE_ROOT_READ | ( | root, | |
func, | |||
... | |||
) |
Execute a read-only operation on the root node. This will prevent any write operation from interfering with the tree while the read operation occurs.
The steps:
[in] | root | The root node structure. |
[in] | func | The function to call. The first argument will be the node followed by any additional arguments. |
[in] | ... | Additional arguments to pass to the function. |
#define RBT_NODE_ROOT_WRITE | ( | root, | |
func, | |||
... | |||
) |
Execute a write operation on the root node. This will prevent any other write operation from interfering with the tree while the operation occurs.
The operation will wait for all read operations to finish.
The steps:
[in] | root | The root node structure. |
[in] | func | The function to call. The first argument will be the node followed by any additional arguments. |
[in] | ... | Additional arguments to pass to the function. |
typedef struct RBT_NODE_ROOT_T RBT_NODE_ROOT_T |
A convenient wrapper around root nodes to provide thread safety.
RBT_NODE_ROOT_T RBT_NODE_NEW | ( | ) |
Create a new root node.
Create a new, empty root node. The root node type is a wrapper struct around the node type. It includes mutexes and other variables that are used to protect the data in the tree from corruption caused by concurrent writes.