cleanup: use size_t for new_areas_index and max_new_areas
[sbcl.git] / src / runtime / thread.h
index 249d226..b8b99d3 100644 (file)
 #include "os.h"
 #ifdef LISP_FEATURE_GENCGC
 #include "gencgc-alloc-region.h"
-#else
-struct alloc_region { };
 #endif
 #include "genesis/symbol.h"
 #include "genesis/static-symbols.h"
+
 #include "genesis/thread.h"
 #include "genesis/fdefn.h"
 #include "interrupt.h"
 
-#define STATE_RUNNING (make_fixnum(1))
-#define STATE_SUSPENDED (make_fixnum(2))
-#define STATE_DEAD (make_fixnum(3))
+#define STATE_RUNNING MAKE_FIXNUM(1)
+#define STATE_STOPPED MAKE_FIXNUM(2)
+#define STATE_DEAD MAKE_FIXNUM(3)
 
 #ifdef LISP_FEATURE_SB_THREAD
-
-/* Only access thread state with blockables blocked. */
-static inline lispobj
-thread_state(struct thread *thread)
-{
-    lispobj state;
-    pthread_mutex_lock(thread->state_lock);
-    state = thread->state;
-    pthread_mutex_unlock(thread->state_lock);
-    return state;
-}
-
-static inline void
-set_thread_state(struct thread *thread, lispobj state)
-{
-    pthread_mutex_lock(thread->state_lock);
-    thread->state = state;
-    pthread_cond_broadcast(thread->state_cond);
-    pthread_mutex_unlock(thread->state_lock);
-}
-
-static inline void
-wait_for_thread_state_change(struct thread *thread, lispobj state)
-{
-    pthread_mutex_lock(thread->state_lock);
-    while (thread->state == state)
-        pthread_cond_wait(thread->state_cond, thread->state_lock);
-    pthread_mutex_unlock(thread->state_lock);
-}
-
+lispobj thread_state(struct thread *thread);
+void set_thread_state(struct thread *thread, lispobj state);
+void wait_for_thread_state_change(struct thread *thread, lispobj state);
 extern pthread_key_t lisp_thread;
 #endif