[xiph-commits] r13424 - experimental/moritz/thread

moritz at svn.xiph.org moritz at svn.xiph.org
Wed Aug 1 14:01:35 PDT 2007


Author: moritz
Date: 2007-08-01 14:01:35 -0700 (Wed, 01 Aug 2007)
New Revision: 13424

Modified:
   experimental/moritz/thread/Makefile
   experimental/moritz/thread/main.c
   experimental/moritz/thread/thread.c
   experimental/moritz/thread/thread.h
Log:
Tree prototypes et al, and include a config.h file in the header as well
for external debugging control.


Modified: experimental/moritz/thread/Makefile
===================================================================
--- experimental/moritz/thread/Makefile	2007-08-01 21:00:04 UTC (rev 13423)
+++ experimental/moritz/thread/Makefile	2007-08-01 21:01:35 UTC (rev 13424)
@@ -9,7 +9,7 @@
 THREADS =	-pthread
 CC ?=		gcc
 CFLAGS ?=	-O2 -pipe
-CFLAGS +=	-DHAVE_CONFIG_H=1 -DTHREAD_DEBUG=1 -DXALLOC_DEBUG=1 -DXALLOC_WITH_XASPRINTF=1 -fstrict-aliasing -Wall -W -ansi -pedantic -Wwrite-strings -Wpointer-arith -Wformat=2 $(THREADS)
+CFLAGS +=	-DHAVE_CONFIG_H=1 -DTHREAD_DEBUG=1 -DXALLOC_DEBUG=1 -DXALLOC_WITH_XASPRINTF=1 -fstrict-aliasing -Wall -W -ansi -pedantic -Wwrite-strings -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes $(THREADS)
 DEBUG ?=	-g -ggdb
 INCLUDEFLAGS =	-I../compat -I../xalloc -pthread
 LDFLAGS =	-L. -L../xalloc -lxalloc -lthread $(THREADS)

Modified: experimental/moritz/thread/main.c
===================================================================
--- experimental/moritz/thread/main.c	2007-08-01 21:00:04 UTC (rev 13423)
+++ experimental/moritz/thread/main.c	2007-08-01 21:01:35 UTC (rev 13424)
@@ -10,6 +10,8 @@
 #include "xalloc.h"
 #include "thread.h"
 
+void *	hello(void *);
+
 void *
 hello(void *arg)
 {

Modified: experimental/moritz/thread/thread.c
===================================================================
--- experimental/moritz/thread/thread.c	2007-08-01 21:00:04 UTC (rev 13423)
+++ experimental/moritz/thread/thread.c	2007-08-01 21:01:35 UTC (rev 13424)
@@ -101,7 +101,7 @@
 	pthread_t	 sys_thread;
 };
 RB_HEAD(thread_tree, thread) thread_tree_head = RB_INITIALIZER(&thread_tree_head);
-RB_GENERATE(thread_tree, thread, entry, _thread_cmp)
+RB_PROTOTYPE(thread_tree, thread, entry, _thread_cmp)
 
 struct thread_start {
 	void *		(*start_routine)(void *);
@@ -122,7 +122,7 @@
 	pthread_mutex_t  sys_mutex;
 };
 RB_HEAD(mutex_tree, mutex) mutex_tree_head = RB_INITIALIZER(&mutex_tree_head);
-RB_GENERATE(mutex_tree, mutex, entry, _mutex_cmp)
+RB_PROTOTYPE(mutex_tree, mutex, entry, _mutex_cmp)
 
 struct cond {
 	RB_ENTRY(cond)	 entry;
@@ -135,7 +135,7 @@
 	pthread_cond_t	 sys_cond;
 };
 RB_HEAD(cond_tree, cond) cond_tree_head = RB_INITIALIZER(&cond_tree_head);
-RB_GENERATE(cond_tree, cond, entry, _cond_cmp)
+RB_PROTOTYPE(cond_tree, cond, entry, _cond_cmp)
 
 struct rwlock {
 	RB_ENTRY(rwlock) entry;
@@ -147,7 +147,7 @@
 	pthread_rwlock_t sys_rwlock;
 };
 RB_HEAD(rwlock_tree, rwlock) rwlock_tree_head = RB_INITIALIZER(&rwlock_tree_head);
-RB_GENERATE(rwlock_tree, rwlock, entry, _rwlock_cmp)
+RB_PROTOTYPE(rwlock_tree, rwlock, entry, _rwlock_cmp)
 
 
 static int		 thread_initialized = 0;
@@ -165,6 +165,11 @@
 static const char	*unknown_file = "<unknown>";
 
 
+RB_GENERATE(thread_tree, thread, entry, _thread_cmp)
+RB_GENERATE(mutex_tree, mutex, entry, _mutex_cmp)
+RB_GENERATE(cond_tree, cond, entry, _cond_cmp)
+RB_GENERATE(rwlock_tree, rwlock, entry, _rwlock_cmp)
+
 void
 _thread_fatal(int errnum, const char *fmt, ...)
 {

Modified: experimental/moritz/thread/thread.h
===================================================================
--- experimental/moritz/thread/thread.h	2007-08-01 21:00:04 UTC (rev 13423)
+++ experimental/moritz/thread/thread.h	2007-08-01 21:01:35 UTC (rev 13424)
@@ -27,6 +27,10 @@
 #ifndef __THREAD_H__
 #define __THREAD_H__
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 /*
  * Define THREAD_DEBUG to get the thread_debug_initialize_debug() function,
  * which enables debugging output of /level/s between 0 and 4, inclusive.



More information about the commits mailing list