mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
A define to make Redis more helgrind friendly
This commit is contained in:
parent
1064ef8764
commit
b04a5df979
14
redis.c
14
redis.c
@ -75,6 +75,11 @@
|
||||
#include "lzf.h" /* LZF compression library */
|
||||
#include "pqsort.h" /* Partial qsort for SORT+LIMIT */
|
||||
|
||||
/* #define REDIS_HELGRIND_FRIENDLY */
|
||||
#if defined(__GNUC__) && defined(REDIS_HELGRIND_FRIENDLY)
|
||||
#warning "Remember to undef REDIS_HELGRIND_FRIENDLY before to commit"
|
||||
#endif
|
||||
|
||||
/* Error codes */
|
||||
#define REDIS_OK 0
|
||||
#define REDIS_ERR -1
|
||||
@ -7664,6 +7669,15 @@ static void *IOThreadEntryPoint(void *arg) {
|
||||
/* Get a new job to process */
|
||||
lockThreadedIO();
|
||||
if (listLength(server.io_newjobs) == 0) {
|
||||
#ifdef REDIS_HELGRIND_FRIENDLY
|
||||
/* No new jobs? Wait and retry, because to be Helgrind
|
||||
* (valgrind --tool=helgrind) what's needed is to take
|
||||
* the same threads running instead to create/destroy threads
|
||||
* as needed (otherwise valgrind will fail) */
|
||||
unlockThreadedIO();
|
||||
usleep(1); /* Give some time for the I/O thread to work. */
|
||||
continue;
|
||||
#endif
|
||||
/* No new jobs in queue, exit. */
|
||||
redisLog(REDIS_DEBUG,"Thread %lld exiting, nothing to do",
|
||||
(long long) pthread_self());
|
||||
|
Loading…
Reference in New Issue
Block a user