[sheepdog] [PATCH 2/6] work queue: don't call worker func if not assigned

Liu Yuan namei.unix at gmail.com
Tue Mar 26 10:46:21 CET 2013


From: Liu Yuan <tailai.ly at taobao.com>

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/work.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sheep/work.c b/sheep/work.c
index 602c997..2e1c8f0 100644
--- a/sheep/work.c
+++ b/sheep/work.c
@@ -224,7 +224,8 @@ retest:
 		list_del(&work->w_list);
 		pthread_mutex_unlock(&wi->pending_lock);
 
-		work->fn(work);
+		if (work->fn)
+			work->fn(work);
 
 		pthread_mutex_lock(&wi->finished_lock);
 		list_add_tail(&work->w_list, &wi->finished_list);
-- 
1.7.9.5




More information about the sheepdog mailing list