Revision ba93696f xseg/xtypes/xworkq.c

b/xseg/xtypes/xworkq.c
68 68
	work->job = job;
69 69
	if (__xworkq_enqueue(wq, work) < 0)
70 70
		return -1;
71
	xworkq_signal(wq);
72 71
	return 0;
73 72
}
74 73

  
......
77 76
	xqindex xqi;
78 77
	struct work *w;
79 78
	while (xq_count(wq->q)){
80
		if (!xlock_try_lock(wq->lock, 2))
79
		if (wq->lock && !xlock_try_lock(wq->lock, 2))
81 80
			return;
82 81

  
83 82
		while (xq_count(wq->q)){
......
85 84
			xqi = __xq_pop_head(wq->q);
86 85
			xlock_release(&wq->q_lock);
87 86
			if (xqi == Noneidx){
88
				xlock_release(wq->lock);
87
				if (wq->lock)
88
					xlock_release(wq->lock);
89 89
				return;
90 90
			}
91 91
			w = (struct work *)xqi;
......
93 93
			xtypes_free(w);
94 94
		}
95 95

  
96
		xlock_release(wq->lock);
96
		if (wq->lock)
97
			xlock_release(wq->lock);
97 98
	}
98 99

  
99 100
	return;

Also available in: Unified diff