[xiph-cvs] cvs commit: vorbis-tools/ogg123 ogg123.c
Stan Seibert
volsung at xiph.org
Mon Sep 24 14:11:35 PDT 2001
volsung 01/09/24 14:11:35
Modified: ogg123 Tag: kcarnold_work ogg123.c
Log:
A better locking solution. Since updating status is not critical, there is
no point in blocking one of the threads while the other is updating the
status.
Revision Changes Path
No revision
No revision
1.39.2.30 +6 -5 vorbis-tools/ogg123/ogg123.c
Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.39.2.29
retrieving revision 1.39.2.30
diff -u -r1.39.2.29 -r1.39.2.30
--- ogg123.c 2001/09/24 18:44:46 1.39.2.29
+++ ogg123.c 2001/09/24 21:11:34 1.39.2.30
@@ -14,7 +14,7 @@
* *
********************************************************************
- last mod: $Id: ogg123.c,v 1.39.2.29 2001/09/24 18:44:46 volsung Exp $
+ last mod: $Id: ogg123.c,v 1.39.2.30 2001/09/24 21:11:34 volsung Exp $
********************************************************************/
@@ -245,10 +245,11 @@
void Ogg123UpdateStats (void)
{
- pthread_mutex_lock(&stats_lock);
- SetBuffersStats ();
- UpdateStats (Options.statOpts.stats);
- pthread_mutex_unlock(&stats_lock);
+ if (pthread_mutex_trylock(&stats_lock) == 0) {
+ SetBuffersStats ();
+ UpdateStats (Options.statOpts.stats);
+ pthread_mutex_unlock(&stats_lock);
+ }
}
/* /status interface */
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list