extern __thread processor_t *self;
extern processor_t *gc_processor;
+extern void mutex_lock (pthread_mutex_t *mutex);
+extern void mutex_unlock (pthread_mutex_t *mutex);
+
extern void setup_processors (int count);
extern void start_processors (void);
#define MUTEX_INITIALIZER PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-#else
+#define LOCK() do \
+{ \
+ if (smp_trace_p && locked_p != false) \
+ outf_error_line (";%d already locked!", self->id); \
+ mutex_lock (&mutex); \
+ locked_p = true; \
+} while (false)
+
+#define UNLOCK() do \
+{ \
+ if (smp_trace_p && locked_p != true) \
+ outf_error_line (";%d already unlocked!", self->id); \
+ mutex_unlock (&mutex); \
+ locked_p = false; \
+} while (false)
+
+#else /* !ENABLE_DEBUGGING_TOOLS */
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#endif
+#define LOCK() do \
+{ \
+ mutex_lock (&mutex); \
+} while (false)
+
+#define UNLOCK() do \
+{ \
+ mutex_unlock (&mutex); \
+} while (false)
+
+#endif /* !ENABLE_DEBUGGING_TOOLS */
+
+#else /* !ENABLE_SMP */
+
+#define LOCK() do { } while (false)
+#define UNLOCK() do { } while (false)
-#endif /* ENABLE_SMP */
+#endif /* !ENABLE_SMP */
#endif /* SCM_OSSMP_H */
static void pthread_error (int code);
-static void
+void
mutex_lock (pthread_mutex_t *mutex)
{
int err = pthread_mutex_lock (mutex);
}
}
-static void
+void
mutex_unlock (pthread_mutex_t *mutex)
{
int err = pthread_mutex_unlock (mutex);