diff --git a/README.md b/README.md index b94fccc..02cd4d2 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ A simple, light-weight C/C++ Redis client. __RedisX__ is a light-weight [Redis](https://redis.io) client for C/C++. As such, it should also work with Redis forks / clones like [Dragonfly](https://dragonfly.io) or [Valkey](https://valkey.io). It supports both interactive and -pipelined Redis queries, managing and processing subscriptions. It also supports atomic execution blocks and LUA -scripts loading. It can be used with one or more distinct Redis servers simultaneously. +pipelined Redis queries, managing and processing subscriptions, atomic execution blocks, and LUA scripts loading. It +can be used with multiple Redis servers simultaneously also. While there are other C/C++ Redis clients available, this one is C90 compatible, and hence can be used on older platforms also. It is also small and fast, but still capable and versatile. @@ -49,12 +49,6 @@ the pace new commands are being introduced all the time), it provides a basic fr asynchronous queries, with some higher-level functions for managing key/value storage types (including hash tables), and PUB/SUB. Future releases may add further higher-level functionality based on demand for such features. -The library maintains up to three separate connections (channels) for each separate Redis server instance used: (1) an -interactive client for sequential round-trip transactions, (2) a pipeline client for bulk queries and asynchronous -background processing, and (3) a subscription client for PUB/SUB requests and notifications. The interactive client is -always connected, the pipeline client is connected only if explicitly requested at the time of establishing the server -connection, while the subscription client is connected only as needed. - The __RedisX__ library was created, and is maintained, by Attila Kovács at the Center for Astrophysics \| Harvard & Smithsonian, and it is available through the [Smithsonian/redisx](https://github.com/Smithsonian/redisx) repository on GitHub. @@ -97,7 +91,7 @@ prior to invoking `make`. The following build variables can be configured: - `CFLAGS`: Flags to pass onto the C compiler (default: `-Os -Wall`). Note, `-Iinclude` will be added automatically. - - `LDFLAGS`: Linker flags (default is `-lm`). + - `LDFLAGS`: Linker flags (default is `-lm`). Note, `-lxchange` will be added automatically. - `CHECKEXTRA`: Extra options to pass to `cppcheck` for the `make check` target @@ -117,6 +111,12 @@ desired `make` target(s). (You can use `make help` to get a summary of the avail - [Disconnecting](#disconnecting) - [Connection hooks](#connection-hooks) +The library maintains up to three separate connections (channels) for each separate Redis server instance used: (1) an +interactive client for sequential round-trip transactions, (2) a pipeline client for bulk queries and asynchronous +background processing, and (3) a subscription client for PUB/SUB requests and notifications. The interactive client is +always connected, the pipeline client is connected only if explicitly requested at the time of establishing the server +connection, while the subscription client is connected only as needed. + ### Initializing diff --git a/config.mk b/config.mk index f803197..d375cf0 100644 --- a/config.mk +++ b/config.mk @@ -29,18 +29,21 @@ CFLAGS ?= -Os -Wall # Add include/ directory CFLAGS += -I$(INC) +# Extra warnings (not supported on all compilers) +#CFLAGS += -Wextra + # Link against math libs (for e.g. isnan()) LDFLAGS ?= -lm # Compile and link against a specific xchange library (if defined) ifdef XCHANGE CFLAGS += -I$(XCHANGE)/include - LDFLAGS += -L$(XCHANGE)/lib -lxchange + LDFLAGS = -L$(XCHANGE)/lib LD_LIBRARY_PATH = $(XCHANGE)/lib:$(LD_LIBRARY_PATH) endif -# Extra warnings (not supported on all compilers) -#CFLAGS += -Wextra +# Always link against the xchange lib. +LDFLAGS += -lxchange # cppcheck options for 'check' target CHECKOPTS ?= --enable=performance,warning,portability,style --language=c \ diff --git a/include/redisx.h b/include/redisx.h index becbcb9..7301154 100644 --- a/include/redisx.h +++ b/include/redisx.h @@ -37,7 +37,7 @@ #ifndef REDISX_LISTENER_REL_PRIORITY /// [0.0:1.0] Listener priority as fraction of available range /// You may want to set it quite high to ensure that the receive buffer is promptly cleared. -# define REDISX_LISTENER_REL_PRIORITY (0.9) +# define REDISX_LISTENER_REL_PRIORITY (0.5) #endif // Various exposed constants -----------------------------------------------------> @@ -199,7 +199,7 @@ typedef struct Redis { * be binary a '\0' termination should no be assumed. Instead, the * length of the message is specified explicitly. */ -typedef void (*RedisSubscriberCall)(const char *pattern, const char *channel, const char *msg, int length); +typedef void (*RedisSubscriberCall)(const char *pattern, const char *channel, const char *msg, long length); /** diff --git a/resources/header.html b/resources/header.html index e98bc8a..e2af612 100644 --- a/resources/header.html +++ b/resources/header.html @@ -6,7 +6,7 @@ - + diff --git a/src/redisx-sub.c b/src/redisx-sub.c index 0617559..723bbbf 100644 --- a/src/redisx-sub.c +++ b/src/redisx-sub.c @@ -480,10 +480,6 @@ void redisxEndSubscription(Redis *redis) { } static void rNotifyConsumers(Redis *redis, char *pattern, char *channel, char *msg, int length) { -#if REDISX_LISTENER_YIELD_COUNT > 0 - static int count; -#endif - MessageConsumer *c; RedisPrivate *p; RedisSubscriberCall *f = NULL; @@ -519,11 +515,6 @@ static void rNotifyConsumers(Redis *redis, char *pattern, char *channel, char *m for(i=0; i 0 - // Allow the waiting processes to take control... - if(++count % REDISX_LISTENER_YIELD_COUNT == 0) sched_yield(); -#endif } /// \cond PRIVATE diff --git a/src/redisx.c b/src/redisx.c index 43321c2..b315e9d 100644 --- a/src/redisx.c +++ b/src/redisx.c @@ -31,7 +31,7 @@ #define XPRIO_MAX (sched_get_priority_max(SCHED_RR)) #define XPRIO_RANGE (XPRIO_MAX - XPRIO_MIN) -#define REDISX_LISTENER_PRIORITY (XPRIO_MIN + (int) (REDISX_LISTENER_REL_PRIORITY * XPRIO_RANGE)) +#define REDISX_LISTENER_PRIORITY (XPRIO_MIN + (int) (REDISX_LISTENER_REL_PRIORITY * XPRIO_RANGE)) typedef struct ServerLink { Redis *redis;