pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:1:   /* -  * $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.    */   #include <signal.h>      #ifdef HAVE_SYS_TYPES_H   /* Needed for pthread_t on OSF/1 */   #include <sys/types.h>   #endif /* HAVE_SYS_TYPES_H */   #ifdef PIKE_THREADS
pike.git/src/threads.h:327:    mt_unlock(&((im)->lock)); \    } \    } while(0)      #define THREAD_NOT_STARTED -1   #define THREAD_RUNNING 0   #define THREAD_EXITED 1      #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 *   #endif      #ifndef TH_STDCALL   #define TH_STDCALL   #endif      #ifndef th_destroy   #define th_destroy(X)
pike.git/src/threads.h:451:    Pike_stack_top=(_tmp)->Pike_stack_top;\    thread_id=(_tmp)->thread_id;\    DO_IF_PROFILING( accounted_time=(_tmp)->accounted_time; ) \    DO_IF_PROFILING( time_base = gethrtime() - (_tmp)->time_base; ) \    DO_IF_SECURITY( current_creds = (_tmp)->current_creds ;) \    SWAP_IN_TRACE(_tmp); \    } while(0)      #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)) \      #define SWAP_IN_CURRENT_THREAD() \    THREADS_FPRINTF(1, (stderr, "SWAP_IN_CURRENT_THREAD() %s:%d ... t:%08x\n", \    __FILE__, __LINE__, (unsigned int)_tmp->thread_id)); \    SWAP_IN_THREAD(_tmp);\    } while(0)   
pike.git/src/threads.h:485:   /* Note that the semi-colon below is needed to add an empty statement    * in case there is a label before the macro.    */   #define REVEAL_GLOBAL_VARIABLES() ; } while(0)   #else /* PIKE_DEBUG */   #define HIDE_GLOBAL_VARIABLES()   #define REVEAL_GLOBAL_VARIABLES()   #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) \    fatal("thread_for_id() (or thread_id) failed! %p != %p\n",thread_for_id(th_self()),thread_id); \    if (Pike_in_gc > 50 && Pike_in_gc < 300) \    fatal("Threads allowed during garbage collection.\n"); \    }) \    if(num_threads > 1 && !threads_disabled) { \    SWAP_OUT_THREAD(_tmp); \    THREADS_FPRINTF(1, (stderr, "THREADS_ALLOW() %s:%d t:%08x(#%d)\n", \
pike.git/src/threads.h:526:    "THREADS_DISALLOW(): Threads disabled\n")); \    co_wait_interpreter(&threads_disabled_change); \    } \    SWAP_IN_THREAD(_tmp);\    } \    DO_IF_DEBUG( if(thread_for_id(th_self()) != thread_id) \    fatal("thread_for_id() (or thread_id) failed! %p != %p\n",thread_for_id(th_self()),thread_id) ; ) \    } 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) \    fatal("thread_for_id() (or thread_id) failed! %p != %p\n",thread_for_id(th_self()),thread_id); \    if (Pike_in_gc > 50 && Pike_in_gc < 300) \    fatal("Threads allowed during garbage collection.\n"); \    }) \    if(num_threads > 1 && !threads_disabled) { \    SWAP_OUT_THREAD(_tmp_uid); \    live_threads++; \
pike.git/src/threads.h:563:    co_broadcast(&live_threads_change); \    while (threads_disabled) { \    THREADS_FPRINTF(1, (stderr, "THREADS_DISALLOW_UID(): Wait...\n")); \    co_wait_interpreter(&threads_disabled_change); \    } \    SWAP_IN_THREAD(_tmp_uid);\    } \    } 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)      #else   #define ASSERT_THREAD_SWAPPED_IN()   #endif      /* Prototypes begin here */   int low_nt_create_thread(unsigned Pike_stack_size,    unsigned (TH_STDCALL *func)(void *),
pike.git/src/threads.h:593:   struct thread_local;   void low_init_threads_disable(void);   void init_threads_disable(struct object *o);   void exit_threads_disable(struct object *o);   void init_interleave_mutex(IMUTEX_T *im);   void exit_interleave_mutex(IMUTEX_T *im);   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);   TH_RETURN_TYPE new_thread_func(void * data);   void f_thread_create(INT32 args);   void f_thread_set_concurrency(INT32 args);   void f_this_thread(INT32 args);   struct mutex_storage;   struct key_storage;   void f_mutex_lock(INT32 args);
pike.git/src/threads.h:701:   #else   #define STATIC_MUTEX_INIT   #endif   #ifdef PTHREAD_COND_INITIALIZER   #define STATIC_COND_INIT = PTHREAD_COND_INITIALIZER   #else   #define STATIC_COND_INIT   #endif       + /* for compatibility */ + #include "interpret.h"      #endif /* THREADS_H */