diff --git a/src/global.h b/src/global.h
index ee28a39ded8acfbb1bbb609956b4bf891f9cb885..292365da9121e882646e7532929d46087f846cb3 100644
--- a/src/global.h
+++ b/src/global.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: global.h,v 1.42 2000/01/10 00:52:11 hubbe Exp $
+ * $Id: global.h,v 1.43 2000/06/24 07:20:27 hubbe Exp $
  */
 #ifndef GLOBAL_H
 #define GLOBAL_H
@@ -285,6 +285,13 @@ typedef struct p_wchar_p
 #define DO_PIKE_CLEANUP
 #endif
 
+#ifdef PIKE_SECURITY
+#define DO_IF_SECURITY(X) X
+#else
+#define DO_IF_SECURITY(X)
+#endif
+
+
 #include "port.h"
 #include "dmalloc.h"
 
diff --git a/src/interpret.h b/src/interpret.h
index fb55960ff306e7b93b3b16f2d97d4e7e31108a31..7f924165c86f4da43446585ebb88faf458a03678 100644
--- a/src/interpret.h
+++ b/src/interpret.h
@@ -5,13 +5,48 @@
 \*/
 
 /*
- * $Id: interpret.h,v 1.43 2000/06/21 00:55:24 hubbe Exp $
+ * $Id: interpret.h,v 1.44 2000/06/24 07:20:27 hubbe Exp $
  */
 #ifndef INTERPRET_H
 #define INTERPRET_H
 
 #include "global.h"
 #include "program.h"
+#include "threads.h"
+
+
+struct Pike_interpreter {
+  char swapped;
+  char status;
+#ifdef PIKE_THREADS
+  COND_T status_change;
+  THREAD_T id;
+#endif
+  struct Pike_interpreter *hashlink, **backlink;
+  struct mapping *thread_local;
+
+  /* Swapped variables */
+  struct svalue *Pike_sp,*Pike_evaluator_stack;
+  struct svalue **Pike_mark_sp,**Pike_mark_stack;
+  struct pike_frame *Pike_fp;
+  int evaluator_stack_malloced;
+  int mark_stack_malloced;
+  JMP_BUF *recoveries;
+  struct object * thread_id;
+  char *Pike_stack_top;
+  DO_IF_SECURITY(struct object *current_creds;)
+
+#ifdef PROFILING
+#ifdef HAVE_GETHRTIME
+  long long accounted_time;
+  long long time_base;
+#endif
+#endif
+
+#ifdef THREAD_TRACE
+  int t_flag;
+#endif /* THREAD_TRACE */
+};
 
 #ifndef STRUCT_FRAME_DECLARED
 #define STRUCT_FRAME_DECLARED
diff --git a/src/modules/HTTPLoop/cache.c b/src/modules/HTTPLoop/cache.c
index cfe12688d141fe3e93714e4152a1fbe74b907b2f..2ba32ebc2e2c47f0405ab08da670081594b4b1c2 100644
--- a/src/modules/HTTPLoop/cache.c
+++ b/src/modules/HTTPLoop/cache.c
@@ -77,7 +77,7 @@ static void really_free_from_queue()
 
 static int ensure_interpreter_lock( )
 {
-  struct thread_state *thi;
+  struct Pike_interpreter *thi;
   int free=0;
   if( (thi = thread_state_for_id( th_self() )) )
   {
diff --git a/src/modules/Java/jvm.c b/src/modules/Java/jvm.c
index 0b9d83208d347775ac8ead2ef8cdbe8a61e34eae..21da30120e443758d29de46510135fd604c9e505 100644
--- a/src/modules/Java/jvm.c
+++ b/src/modules/Java/jvm.c
@@ -1,5 +1,5 @@
 /*
- * $Id: jvm.c,v 1.19 2000/06/10 11:52:46 mast Exp $
+ * $Id: jvm.c,v 1.20 2000/06/24 07:20:37 hubbe Exp $
  *
  * Pike interface to Java Virtual Machine
  *
@@ -16,7 +16,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include "global.h"
-RCSID("$Id: jvm.c,v 1.19 2000/06/10 11:52:46 mast Exp $");
+RCSID("$Id: jvm.c,v 1.20 2000/06/24 07:20:37 hubbe Exp $");
 #include "program.h"
 #include "interpret.h"
 #include "stralloc.h"
@@ -1651,7 +1651,7 @@ static void native_dispatch(struct native_method_context *ctx,
 			    jvalue *rc)
 {
   extern struct program *thread_id_prog;
-  struct thread_state *state;
+  struct Pike_interpreter *state;
 
   if((state = thread_state_for_id(th_self()))!=NULL) {
     /* This is a pike thread.  Do we have the interpreter lock? */
@@ -1677,14 +1677,14 @@ static void native_dispatch(struct native_method_context *ctx,
     recoveries = NULL;
     thread_id = low_clone(thread_id_prog);
     call_c_initializers(thread_id);
-    SWAP_OUT_THREAD((struct thread_state *)thread_id->storage);
-    ((struct thread_state *)thread_id->storage)->swapped=0;
-    ((struct thread_state *)thread_id->storage)->id=th_self();
+    SWAP_OUT_THREAD((struct Pike_interpreter *)thread_id->storage);
+    ((struct Pike_interpreter *)thread_id->storage)->swapped=0;
+    ((struct Pike_interpreter *)thread_id->storage)->id=th_self();
     num_threads++;
     thread_table_insert(thread_id);
     do_native_dispatch(ctx, env, cls, args, rc);
-    ((struct thread_state *)(thread_id->storage))->status=THREAD_EXITED;
-    co_signal(& ((struct thread_state *)(thread_id->storage))->status_change);
+    ((struct Pike_interpreter *)(thread_id->storage))->status=THREAD_EXITED;
+    co_signal(& ((struct Pike_interpreter *)(thread_id->storage))->status_change);
     thread_table_delete(thread_id);
     free_object(thread_id);
     thread_id=NULL;
diff --git a/src/threads.c b/src/threads.c
index a387a95c09484300cca8668198c102c91dbf0fd6..0187e6d08bb9a5b98ab05d1578be5b22cb57bb36 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.130 2000/06/24 00:48:13 hubbe Exp $");
+RCSID("$Id: threads.c,v 1.131 2000/06/24 07:20:27 hubbe Exp $");
 
 int num_threads = 1;
 int threads_disabled = 0;
@@ -194,7 +194,7 @@ int co_destroy(COND_T *c)
 #endif
 
 
-#define THIS_THREAD ((struct thread_state *)CURRENT_STORAGE)
+#define THIS_THREAD ((struct Pike_interpreter *)CURRENT_STORAGE)
 
 struct object *thread_id = NULL;
 static struct callback *threads_evaluator_callback=0;
@@ -385,7 +385,7 @@ void exit_interleave_mutex(IMUTEX_T *im)
 
 #define THREAD_TABLE_SIZE 127  /* Totally arbitrary prime */
 
-static struct thread_state *thread_table_chains[THREAD_TABLE_SIZE];
+static struct Pike_interpreter *thread_table_chains[THREAD_TABLE_SIZE];
 static int num_pike_threads=0;
 
 void thread_table_init(void)
@@ -415,7 +415,7 @@ static void dumpmem(char *desc, void *x, int size)
 
 void thread_table_insert(struct object *o)
 {
-  struct thread_state *s = OBJ2THREAD(o);
+  struct Pike_interpreter *s = OBJ2THREAD(o);
   unsigned INT32 h = thread_table_hash(&s->id);
 #ifdef PIKE_DEBUG
   if(h>=THREAD_TABLE_SIZE)
@@ -440,7 +440,7 @@ void thread_table_insert(struct object *o)
 
 void thread_table_delete(struct object *o)
 {
-  struct thread_state *s = OBJ2THREAD(o);
+  struct Pike_interpreter *s = OBJ2THREAD(o);
 /*  dumpmem("thread_table_delete",&s->id, sizeof(THREAD_T)); */
   mt_lock( & thread_table_lock );
   num_pike_threads--;
@@ -450,10 +450,10 @@ void thread_table_delete(struct object *o)
   mt_unlock( & thread_table_lock );
 }
 
-struct thread_state *thread_state_for_id(THREAD_T tid)
+struct Pike_interpreter *thread_state_for_id(THREAD_T tid)
 {
   unsigned INT32 h = thread_table_hash(&tid);
-  struct thread_state *s = NULL;
+  struct Pike_interpreter *s = NULL;
 #if 0
   if(num_threads>1)
     dumpmem("thread_state_for_id: ",&tid,sizeof(tid));
@@ -477,7 +477,7 @@ struct thread_state *thread_state_for_id(THREAD_T tid)
       if(th_equal(s->id, tid))
 	break;
     if(s != NULL) {
-      /* Move the thread_state to the head of the chain, in case
+      /* Move the Pike_interpreter to the head of the chain, in case
 	 we want to search for it again */
 
       /* Unlink */
@@ -503,7 +503,7 @@ struct thread_state *thread_state_for_id(THREAD_T tid)
 
 struct object *thread_for_id(THREAD_T tid)
 {
-  struct thread_state *s = thread_state_for_id(tid);
+  struct Pike_interpreter *s = thread_state_for_id(tid);
   return (s == NULL? NULL : THREADSTATE2OBJ(s));
   /* See NB in thread_state_for_id.  Lifespan of result can be prolonged
      by incrementing refcount though. */
@@ -517,7 +517,7 @@ void f_all_threads(INT32 args)
 
   INT32 x;
   struct svalue *oldsp;
-  struct thread_state *s;
+  struct Pike_interpreter *s;
 
   pop_n_elems(args);
   oldsp = sp;
@@ -1019,8 +1019,8 @@ void exit_cond_obj(struct object *o) { co_destroy(THIS_COND); }
 
 void f_thread_backtrace(INT32 args)
 {
-  struct thread_state *foo = THIS_THREAD;
-  struct thread_state *bar = OBJ2THREAD( thread_id );
+  struct Pike_interpreter *foo = THIS_THREAD;
+  struct Pike_interpreter *bar = OBJ2THREAD( thread_id );
   struct svalue *osp = sp;
   pop_n_elems(args);
   if(foo->sp)
@@ -1057,7 +1057,7 @@ void f_thread_id__sprintf (INT32 args)
 
 static void f_thread_id_result(INT32 args)
 {
-  struct thread_state *th=THIS_THREAD;
+  struct Pike_interpreter *th=THIS_THREAD;
 
   SWAP_OUT_CURRENT_THREAD();
 
@@ -1074,7 +1074,7 @@ static void f_thread_id_result(INT32 args)
 
 void init_thread_obj(struct object *o)
 {
-  MEMSET(THIS_THREAD, 0, sizeof(struct thread_state));
+  MEMSET(THIS_THREAD, 0, sizeof(struct Pike_interpreter));
   THIS_THREAD->status=THREAD_NOT_STARTED;
   co_init(& THIS_THREAD->status_change);
   THIS_THREAD->thread_local=NULL;
@@ -1093,14 +1093,14 @@ void exit_thread_obj(struct object *o)
 
 static void thread_was_recursed(struct object *o)
 {
-  struct thread_state *tmp=THIS_THREAD;
+  struct Pike_interpreter *tmp=THIS_THREAD;
   if(tmp->thread_local != NULL)
     gc_recurse_mapping(tmp->thread_local);
 }
 
 static void thread_was_checked(struct object *o)
 {
-  struct thread_state *tmp=THIS_THREAD;
+  struct Pike_interpreter *tmp=THIS_THREAD;
   if(tmp->thread_local != NULL)
     debug_gc_check(tmp->thread_local, T_OBJECT, o);
 
@@ -1295,7 +1295,7 @@ void th_init(void)
 	   OPT_SIDE_EFFECT);
 
   START_NEW_PROGRAM_ID(THREAD_ID);
-  thread_storage_offset=ADD_STORAGE(struct thread_state);
+  thread_storage_offset=ADD_STORAGE(struct Pike_interpreter);
   thread_id_result_variable=simple_add_variable("result","mixed",0);
   /* function(:array) */
   ADD_FUNCTION("backtrace",f_thread_backtrace,tFunc(tNone,tArray),0);
diff --git a/src/threads.h b/src/threads.h
index 79a97e02f6b1100346ae6c45b78f0f838c511e0d..b09032eeec6ba08d33aac732c9e39831eebdbd63 100644
--- a/src/threads.h
+++ b/src/threads.h
@@ -1,14 +1,15 @@
 /*
- * $Id: threads.h,v 1.93 2000/06/23 06:17:58 hubbe Exp $
+ * $Id: threads.h,v 1.94 2000/06/24 07:20:27 hubbe Exp $
  */
 #ifndef THREADS_H
 #define THREADS_H
 
 #include "machine.h"
-#include "interpret.h"
 #include "object.h"
 #include "error.h"
 
+struct Pike_interpreter;
+
 /* Needed for the sigset_t typedef, which is needed for
  * the pthread_sigsetmask() prototype on Solaris 2.x.
  */
@@ -334,41 +335,8 @@ struct interleave_mutex
 
 #ifdef PIKE_SECURITY
 extern struct object *current_creds;
-#define DO_IF_SECURITY(X) X
-#else
-#define DO_IF_SECURITY(X)
-#endif
-
-struct thread_state {
-  char swapped;
-  char status;
-  COND_T status_change;
-  THREAD_T id;
-  struct thread_state *hashlink, **backlink;
-  struct mapping *thread_local;
-
-  /* Swapped variables */
-  struct svalue *Pike_sp,*Pike_evaluator_stack;
-  struct svalue **Pike_mark_sp,**Pike_mark_stack;
-  struct pike_frame *Pike_fp;
-  int evaluator_stack_malloced;
-  int mark_stack_malloced;
-  JMP_BUF *recoveries;
-  struct object * thread_id;
-  char *Pike_stack_top;
-  DO_IF_SECURITY(struct object *current_creds;)
-
-#ifdef PROFILING
-#ifdef HAVE_GETHRTIME
-  long long accounted_time;
-  long long time_base;
-#endif
 #endif
 
-#ifdef THREAD_TRACE
-  int t_flag;
-#endif /* THREAD_TRACE */
-};
 
 #ifndef TH_RETURN_TYPE
 #define TH_RETURN_TYPE void *
@@ -458,7 +426,7 @@ struct thread_state {
 
 #define SWAP_OUT_CURRENT_THREAD() \
   do {\
-     struct thread_state *_tmp=OBJ2THREAD(thread_id); \
+     struct Pike_interpreter *_tmp=OBJ2THREAD(thread_id); \
      SWAP_OUT_THREAD(_tmp); \
      THREADS_FPRINTF(1, (stderr, "SWAP_OUT_CURRENT_THREAD() %s:%d t:%08x\n", \
 			 __FILE__, __LINE__, (unsigned int)_tmp->thread_id)) \
@@ -492,12 +460,12 @@ struct thread_state {
 #endif /* PIKE_DEBUG */
 
 #define	OBJ2THREAD(X) \
-  ((struct thread_state *)((X)->storage+thread_storage_offset))
+  ((struct Pike_interpreter *)((X)->storage+thread_storage_offset))
 
 #define THREADSTATE2OBJ(X) ((X)->thread_id)
 
 #define THREADS_ALLOW() do { \
-     struct thread_state *_tmp=OBJ2THREAD(thread_id); \
+     struct Pike_interpreter *_tmp=OBJ2THREAD(thread_id); \
      DO_IF_DEBUG({ \
        extern int Pike_in_gc; \
        if(thread_for_id(th_self()) != thread_id) \
@@ -533,7 +501,7 @@ struct thread_state {
    } while(0)
 
 #define THREADS_ALLOW_UID() do { \
-     struct thread_state *_tmp_uid=OBJ2THREAD(thread_id); \
+     struct Pike_interpreter *_tmp_uid=OBJ2THREAD(thread_id); \
      DO_IF_DEBUG({ \
        extern int Pike_in_gc; \
        if(thread_for_id(th_self()) != thread_id) \
@@ -570,13 +538,13 @@ struct thread_state {
    } while(0)
 
 #define SWAP_IN_THREAD_IF_REQUIRED() do { 			\
-  struct thread_state *_tmp=thread_state_for_id(th_self());	\
+  struct Pike_interpreter *_tmp=thread_state_for_id(th_self());	\
   HIDE_GLOBAL_VARIABLES();					\
   THREADS_DISALLOW()
 
 #ifdef PIKE_DEBUG
 #define ASSERT_THREAD_SWAPPED_IN() do {				\
-    struct thread_state *_tmp=thread_state_for_id(th_self());	\
+    struct Pike_interpreter *_tmp=thread_state_for_id(th_self());	\
     if(_tmp->swapped) fatal("Thread is not swapped in!\n");	\
   }while(0)
 
@@ -600,7 +568,7 @@ void thread_table_init(void);
 unsigned INT32 thread_table_hash(THREAD_T *tid);
 void thread_table_insert(struct object *o);
 void thread_table_delete(struct object *o);
-struct thread_state *thread_state_for_id(THREAD_T tid);
+struct Pike_interpreter *thread_state_for_id(THREAD_T tid);
 struct object *thread_for_id(THREAD_T tid);
 void f_all_threads(INT32 args);
 int count_pike_threads(void);
@@ -708,5 +676,7 @@ extern int thread_storage_offset;
 #endif
 
 
+/* for compatibility */
+#include "interpret.h"
 
 #endif /* THREADS_H */