[pypy-svn] r18289 - pypy/dist/pypy/translator/c/src

pedronis at codespeak.net pedronis at codespeak.net
Sat Oct 8 17:00:44 CEST 2005


Author: pedronis
Date: Sat Oct  8 17:00:41 2005
New Revision: 18289

Modified:
   pypy/dist/pypy/translator/c/src/thread_pthread.h
Log:
missing struct declarations before use in the func prototypes



Modified: pypy/dist/pypy/translator/c/src/thread_pthread.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/thread_pthread.h	(original)
+++ pypy/dist/pypy/translator/c/src/thread_pthread.h	Sat Oct  8 17:00:41 2005
@@ -39,6 +39,38 @@
 
 #define CHECK_STATUS(name)  if (status != 0) { perror(name); error = 1; }
 
+/********************* structs ***********/
+
+#ifdef USE_SEMAPHORES
+
+#include <semaphore.h>
+
+struct RPyOpaque_ThreadLock {
+	sem_t sem;
+	int initialized;
+};
+
+#define RPyOpaque_INITEXPR_ThreadLock  { { /* sem */ }, 0 }
+
+#else                                      /* no semaphores */
+
+/* A pthread mutex isn't sufficient to model the Python lock type
+   (see explanations in CPython's Python/thread_pthread.h */
+struct RPyOpaque_ThreadLock {
+	char             locked; /* 0=unlocked, 1=locked */
+	char             initialized;
+	/* a <cond, mutex> pair to handle an acquire of a locked lock */
+	pthread_cond_t   lock_released;
+	pthread_mutex_t  mut;
+};
+
+#define RPyOpaque_INITEXPR_ThreadLock  {        \
+		0, 0,                           \
+		PTHREAD_COND_INITIALIZER,       \
+		PTHREAD_MUTEX_INITIALIZER       \
+	}
+#endif                                     /* no semaphores */
+
 /* prototypes */
 
 long RPyThreadGetIdent(void);
@@ -126,13 +158,6 @@
 
 #include <semaphore.h>
 
-struct RPyOpaque_ThreadLock {
-	sem_t sem;
-	int initialized;
-};
-
-#define RPyOpaque_INITEXPR_ThreadLock  { { /* sem */ }, 0 }
-
 int RPyThreadLockInit(struct RPyOpaque_ThreadLock *lock)
 {
 	int status, error = 0;
@@ -204,22 +229,6 @@
 #else                                      /* no semaphores */
 /************************************************************/
 
-/* A pthread mutex isn't sufficient to model the Python lock type
-   (see explanations in CPython's Python/thread_pthread.h */
-struct RPyOpaque_ThreadLock {
-	char             locked; /* 0=unlocked, 1=locked */
-	char             initialized;
-	/* a <cond, mutex> pair to handle an acquire of a locked lock */
-	pthread_cond_t   lock_released;
-	pthread_mutex_t  mut;
-};
-
-#define RPyOpaque_INITEXPR_ThreadLock  {        \
-		0, 0,                           \
-		PTHREAD_COND_INITIALIZER,       \
-		PTHREAD_MUTEX_INITIALIZER       \
-	}
-
 int RPyThreadLockInit(struct RPyOpaque_ThreadLock *lock)
 {
 	int status, error = 0;



More information about the Pypy-commit mailing list