[MPlayer-dev-eng] [PATCH] Support CineForm DirectShow codec
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Feb 21 17:48:48 CET 2010
On Sun, Feb 21, 2010 at 04:54:44PM +0100, Steinar H. Gunderson wrote:
> @@ -1372,12 +1375,17 @@
> #endif
> dbgprintf("Win32 Warning: Accessed uninitialized Critical Section (%p)!\n", c);
> }
> - if(cs->locked)
> - if(cs->id==pthread_self())
> - return;
> pthread_mutex_lock(&(cs->mutex));
> - cs->locked=1;
> - cs->id=pthread_self();
> + if (cs->lock_count > 0 && cs->id == pthread_self()) {
> + cs->lock_count++;
> + } else {
> + while (cs->lock_count != 0) {
> + pthread_cond_wait(&(cs->unlocked), &(cs->mutex));
> + }
> + cs->lock_count = 1;
> + cs->id = pthread_self();
> + }
> + pthread_mutex_unlock(&(cs->mutex));
Should be simpler as something like
pthread_mutex_lock(&(cs->mutex));
while (cs->lock_count && cs->id != pthread_self())
pthread_cond_wait(&(cs->unlocked), &(cs->mutex));
cs->lock_count++;
cs->id = pthread_self();
pthread_mutex_unlock(&(cs->mutex));
Otherwise I think it should be ok.
More information about the MPlayer-dev-eng
mailing list