2001-11-02
2001-11-02 14:05:33 by Martin Stjernholm <mast@lysator.liu.se>
-
39f3cc9838cce780c988882045cb58e106037132
(32 lines)
(+2/-30)
[
Show
| Annotate
]
Branch: 7.9
Moved the interleave_mutex macros and related stuff from threads.h to
pike_threadlib.h to improve modularity (the macros were already
defined in pike_threadlib.h in the nonthreaded case).
Rev: src/threads.h:1.118
1:
/*
- * $Id: threads.h,v 1.117 2001/11/01 18:40:12 mast Exp $
+ * $Id: threads.h,v 1.118 2001/11/02 14:05:33 mast Exp $
*/
#ifndef THREADS_H
#define THREADS_H
17: Inside #if defined(PIKE_THREADS)
extern PIKE_MUTEX_T interleave_lock;
- struct interleave_mutex
- {
- struct interleave_mutex *next;
- struct interleave_mutex *prev;
- PIKE_MUTEX_T lock;
- };
-
- #define IMUTEX_T struct interleave_mutex
-
- #define DEFINE_IMUTEX(name) IMUTEX_T name
-
- /* If threads are disabled, we already hold the lock. */
- #define LOCK_IMUTEX(im) do { \
- if (!threads_disabled) { \
- THREADS_FPRINTF(0, (stderr, "Locking IMutex 0x%p...\n", (im))); \
- THREADS_ALLOW(); \
- mt_lock(&((im)->lock)); \
- THREADS_DISALLOW(); \
- } \
- } while(0)
-
- /* If threads are disabled, the lock will be released later. */
- #define UNLOCK_IMUTEX(im) do { \
- if (!threads_disabled) { \
- THREADS_FPRINTF(0, (stderr, "Unlocking IMutex 0x%p...\n", (im))); \
- mt_unlock(&((im)->lock)); \
- } \
- } while(0)
-
+
#define THREAD_NOT_STARTED -1
#define THREAD_RUNNING 0
#define THREAD_EXITED 1