 -        pthread_mutex_init(&(config.updating_slots_mutex), NULL);
 -        pthread_mutex_init(&(config.slots_last_update_mutex), NULL);
      }
-
+ 
      if (config.keepalive == 0) {
 diff --git a/src/replication.c b/src/replication.c
-index 3f98b10620b..be05254e8ee 100644
+index 5ce9f0208..789c94e42 100644
 --- a/src/replication.c
 +++ b/src/replication.c
-@@ -1032,7 +1032,7 @@ void sendBulkToSlave(connection *conn) {
+@@ -1025,7 +1025,7 @@ void sendBulkToSlave(connection *conn) {
              freeClient(slave);
              return;
          }

         pthread_mutex_lock(&io_threads_mutex[i]); /* Thread will be stopped. */
         if (pthread_create(&tid,NULL,IOThreadMain,(void*)(long)i) != 0) {
             serverLog(LL_WARNING,"Fatal: Can't initialize IO thread.");
@@ -3124,7 +3135,7 @@ int handleClientsWithPendingWritesUsingThreads(void) {
     io_threads_op = IO_THREADS_OP_WRITE;
     for (int j = 1; j < server.io_threads_num; j++) {
         int count = listLength(io_threads_list[j]);
-        io_threads_pending[j] = count;
+        setIOPendingCount(j, count);
     }

     /* Also use the main thread to process a slice of clients. */
@@ -3139,7 +3150,7 @@ int handleClientsWithPendingWritesUsingThreads(void) {
     while(1) {
         unsigned long pending = 0;
         for (int j = 1; j < server.io_threads_num; j++)

  * by Helgrind (even if they are less efficient) so that no false positive
  * is reported. */
 // #define __ATOMIC_VAR_FORCE_SYNC_MACROS
 
-#if !defined(__ATOMIC_VAR_FORCE_SYNC_MACROS) && defined(__ATOMIC_RELAXED) && !defined(__sun) && (!defined(__clang__) || !defined(__APPLE__) || __apple_build_version__ > 4210057)
+/* There will be many false positives if we test Redis with Helgrind, since
+ * Helgrind can't understand we have imposed ordering on the program, so
