#ifndef _SBCL_RUNTIME_H_
#define _SBCL_RUNTIME_H_
-/*#define QSHOW */ /* Enable low-level debugging output? */
+#if defined(LISP_FEATURE_SB_THREAD)
+#define thread_self() pthread_self()
+#define thread_kill pthread_kill
+#define thread_sigmask pthread_sigmask
+#define thread_mutex_lock(l) pthread_mutex_lock(l)
+#define thread_mutex_unlock(l) pthread_mutex_unlock(l)
+#else
+#define thread_self() 0
+#define thread_kill kill_safely
+#define thread_sigmask sigprocmask
+#define thread_mutex_lock(l) 0
+#define thread_mutex_unlock(l) 0
+#endif
+
+/* #define QSHOW */ /* Enable low-level debugging output? */
+/* #define QSHOW_SAFE */ /* Enable blocking interrupts for each SHOW. */
#ifdef QSHOW
-#define FSHOW(args) fprintf args
+
+#ifdef QSHOW_SAFE
+
+#include <signal.h>
+extern sigset_t blockable_sigset;
+
+#define QSHOW_BLOCK \
+ sigset_t oldset; \
+ thread_sigmask(SIG_BLOCK, &blockable_sigset, &oldset);
+#define QSHOW_UNBLOCK thread_sigmask(SIG_SETMASK,&oldset,0);
+#else
+#define QSHOW_BLOCK
+#define QSHOW_UNBLOCK
+#endif
+
+#ifdef LISP_FEATURE_SB_THREAD
+#define QSHOW_PREFIX fprintf(stderr, "%lu ", pthread_self());
+#else
+#define QSHOW_PREFIX
+#endif
+
+#define FSHOW(args) \
+ do { \
+ QSHOW_BLOCK \
+ QSHOW_PREFIX \
+ fprintf args; \
+ QSHOW_UNBLOCK \
+ } while (0)
#define SHOW(string) FSHOW((stderr, "/%s\n", string))
+
#else
+
#define FSHOW(args)
#define SHOW(string)
+
#endif
/* Enable extra-verbose low-level debugging output for signals? (You
extern void *successful_malloc (size_t size);
extern char *copied_string (char *string);
+#define RUNTIME_OPTIONS_MAGIC 0x31EBF355
+/* 1 for magic, 1 for boolean, 2 for struct runtime_options fields */
+#define RUNTIME_OPTIONS_WORDS (1 + 1 + 2)
+
+struct runtime_options {
+ size_t dynamic_space_size;
+ size_t thread_control_stack_size;
+};
+
#endif /* _SBCL_RUNTIME_H_ */