[xiph-cvs] cvs commit: net resolver.c

Brendan brendan at xiph.org
Wed Mar 5 18:35:12 PST 2003



brendan     03/03/05 21:35:12

  Modified:    .        configure.in
               .        avl.h
               .        resolver.c
  Log:
  Require NO_THREAD to be defined to turn off locking in avl and net
  According to Karl, defining nops with do{}while(0) is a la mode.

Revision  Changes    Path
1.15      +4 -1      libshout/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/libshout/configure.in,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- configure.in	6 Mar 2003 01:55:19 -0000	1.14
+++ configure.in	6 Mar 2003 02:35:12 -0000	1.15
@@ -111,7 +111,6 @@
 if test "$enable_pthread" != "no"
 then
   ACX_PTHREAD([
-    AC_DEFINE([USE_THREAD], 1, [Define if you want to use the thread library])
     LIBS="$LIBS $PTHREAD_LIBS"
     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     CC="$PTHREAD_CC"
@@ -119,6 +118,10 @@
     ])
 fi
 AM_CONDITIONAL([HAVE_THREAD], [test "$have_thread" == "yes"])
+if test "$have_thread" != "yes"
+then
+  AC_DEFINE([NO_THREAD], 1, [Define if you don't want to use the thread library])
+fi
 
 XIPH_PATH_OGG
 XIPH_PATH_VORBIS

<p><p>1.4       +9 -9      avl/avl.h

Index: avl.h
===================================================================
RCS file: /usr/local/cvsroot/avl/avl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- avl.h	6 Mar 2003 01:55:20 -0000	1.3
+++ avl.h	6 Mar 2003 02:35:12 -0000	1.4
@@ -2,7 +2,7 @@
  * Copyright (C) 1995 by Sam Rushing <rushing at nightmare.com>
  */
 
-/* $Id: avl.h,v 1.3 2003/03/06 01:55:20 brendan Exp $ */
+/* $Id: avl.h,v 1.4 2003/03/06 02:35:12 brendan Exp $ */
 
 #ifndef __AVL_H
 #define __AVL_H
@@ -11,14 +11,14 @@
 extern "C" {
 #endif
 
-#ifdef USE_THREAD
+#ifndef NO_THREAD
 #include "thread.h"
 #else
-#define thread_rwlock_create(x)
-#define thread_rwlock_destroy(x)
-#define thread_rwlock_rlock(x)
-#define thread_rwlock_wlock(x)
-#define thread_rwlock_unlock(x)
+#define thread_rwlock_create(x) do{}while(0)
+#define thread_rwlock_destroy(x) do{}while(0)
+#define thread_rwlock_rlock(x) do{}while(0)
+#define thread_rwlock_wlock(x) do{}while(0)
+#define thread_rwlock_unlock(x) do{}while(0)
 #endif
 
 typedef struct avl_node_tag {
@@ -32,7 +32,7 @@
    * The rest of the bits are used for <rank>
    */
   unsigned long		rank_and_balance;
-#ifdef USE_THREAD
+#ifndef NO_THREAD
   rwlock_t rwlock;
 #endif
 } avl_node;
@@ -68,7 +68,7 @@
   unsigned long			length;
   avl_key_compare_fun_type	compare_fun;
   void * 			compare_arg;
-#ifdef USE_THREAD
+#ifndef NO_THREAD
   rwlock_t rwlock;
 #endif
 } avl_tree;

<p><p>1.7       +7 -7      net/resolver.c

Index: resolver.c
===================================================================
RCS file: /usr/local/cvsroot/net/resolver.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- resolver.c	6 Mar 2003 01:55:20 -0000	1.6
+++ resolver.c	6 Mar 2003 02:35:12 -0000	1.7
@@ -19,13 +19,13 @@
 #include <winsock2.h>
 #endif
 
-#ifdef USE_THREAD
-#include "../thread/thread.h"
+#ifndef NO_THREAD
+#include "thread.h"
 #else
-#define thread_mutex_create(x)
-#define thread_mutex_destroy(x)
-#define thread_mutex_lock(x)
-#define thread_mutex_unlock(x)
+#define thread_mutex_create(x) do{}while(0)
+#define thread_mutex_destroy(x) do{}while(0)
+#define thread_mutex_lock(x) do{}while(0)
+#define thread_mutex_unlock(x) do{}while(0)
 #endif
 
 #include "resolver.h"
@@ -37,7 +37,7 @@
 
 /* internal data */
 
-#ifdef USE_THREAD
+#ifndef NO_THREAD
 static mutex_t _resolver_mutex;
 #endif
 static int _initialized = 0;

<p><p>--- >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