Skip to content
Snippets Groups Projects
Commit 93cd2b19 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

HTTPLoop: Improved concurrency of log_as_array() and log_size().

Release the interpeter lock before locking the log_lock.
parent 35462e71
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment