From 3cfe315b0551f27e9d2257c1b927c841cd19143f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 13 Jun 2014 17:19:05 +1000 Subject: [PATCH] Fix locking error and remove entries from jp linked lists --- src/stratifier.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stratifier.c b/src/stratifier.c index 202f73a5..0cf5df90 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2104,10 +2104,12 @@ static void *share_processor(void *arg) if (jp) discard_json_params(&jp); - mutex_lock(&sauth_lock); + mutex_lock(&sshare_lock); if (!sshares) pthread_cond_wait(&sshare_cond, &sshare_lock); jp = sshares; + if (likely(jp)) + DL_DELETE(sshares, jp); mutex_unlock(&sshare_lock); if (unlikely(!jp)) @@ -2154,6 +2156,8 @@ static void *authoriser(void *arg) if (!sauths) pthread_cond_wait(&sauth_cond, &sauth_lock); jp = sauths; + if (likely(jp)) + DL_DELETE(sauths, jp); mutex_unlock(&sauth_lock); if (unlikely(!jp))