Exemplo n.º 1
0
static void *
_worker(void *p) {
	struct global_queue * mq = p;
	for (;;) {
		if (_message_dispatch(mq)) {
			usleep(1000);
			if (mq->total <= 1)
				return NULL;
		} 
	}
	return NULL;
}
Exemplo n.º 2
0
static void *
_worker(void *p) {
	struct global_queue * mq = p;
	for (;;) {
		int i;
		int n = mq->total;
		int ret = 1;
		for (i=0;i<n;i++) {
			ret &= _message_dispatch(mq);
			if (n < mq->total) {
				n = mq->total;
			}
		}
		if (ret) {
			usleep(1000);
			if (mq->total <= 1)
				return NULL;
		} 
	}
	return NULL;
}