[Asterisk-Dev] Re: small patch for better readability in chan_zap.c

Florian Zumbiehl florz at gmx.de
Sat Oct 23 10:47:10 MST 2004


Hi, once more,

> +	if (p->owner) {
> +		while(ast_mutex_trylock(&p->owner->lock))
> +			ast_mutex_unlock(&p->lock);
> +			usleep(1);
> +			ast_mutex_lock(&p->lock);
> +		}
> +		ast_queue_frame(p->owner, f);
> +		ast_mutex_unlock(&p->owner->lock);

well, I guess I missed that p->owner is locked by p->lock, which
is released within the loop, so this probably is a rather bad
idea. I've got no other idea how to write this more readable
then - only the code duplication still could be eliminated, I
think.

Cya, Florian



More information about the asterisk-dev mailing list