From 93cd2b19352b0f79b50046e4bce67a5e9c9a20a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Thu, 12 Oct 2017 11:01:50 +0200
Subject: [PATCH] HTTPLoop: Improved concurrency of log_as_array() and
 log_size().

Release the interpeter lock before locking the log_lock.
---
 src/modules/HTTPLoop/log.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/modules/HTTPLoop/log.c b/src/modules/HTTPLoop/log.c
index a4cad9fbba..17aba1a987 100644
--- a/src/modules/HTTPLoop/log.c
+++ b/src/modules/HTTPLoop/log.c
@@ -90,12 +90,14 @@ void f_aap_log_as_array(INT32 args)
   struct log *l = LTHIS->log;
   int n = 0;
   pop_n_elems(args);
-  
+
+  THREADS_ALLOW();
   mt_lock( &l->log_lock );
   le = l->log_head;
   l->log_head = l->log_tail = 0;
   mt_unlock( &l->log_lock );
-  
+  THREADS_DISALLOW();
+
   while(le)
   {
     struct log_entry *l;
@@ -127,11 +129,13 @@ void f_aap_log_size(INT32 UNUSED(args))
     push_int(0);
     return;
   }
+  THREADS_ALLOW();
   mt_lock( &l->log_lock );
   le = l->log_head; 
   while((le = le->next))
     n++;
   mt_unlock( &l->log_lock );
+  THREADS_DISALLOW();
   push_int(n);
 }
 
-- 
GitLab