pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:1:   /* -  * $Id: threads.h,v 1.84 2000/04/18 06:53:48 jonasw Exp $ +  * $Id: threads.h,v 1.85 2000/04/19 13:57:35 mast Exp $    */   #ifndef THREADS_H   #define THREADS_H      #include "machine.h"   #include "interpret.h"   #include "object.h"   #include "error.h"      /* Needed for the sigset_t typedef, which is needed for
pike.git/src/threads.h:249:      #define co_init(X) do { mt_init(& (X)->lock), (X)->head=(X)->tail=0; }while(0)      int co_wait(COND_T *c, PIKE_MUTEX_T *m);   int co_signal(COND_T *c);   int co_broadcast(COND_T *c);   int co_destroy(COND_T *c);      #endif    + extern int th_running;      extern PIKE_MUTEX_T interpreter_lock;      extern COND_T live_threads_change; /* Used by _disable_threads */   extern COND_T threads_disabled_change; /* Used by _disable_threads */      struct svalue;   struct pike_frame;      extern PIKE_MUTEX_T interleave_lock;
pike.git/src/threads.h:534:    SWAP_IN_THREAD(_tmp_uid);\    } \    } while(0)      #define SWAP_IN_THREAD_IF_REQUIRED() do { \    struct thread_state *_tmp=thread_state_for_id(th_self()); \    HIDE_GLOBAL_VARIABLES(); \    THREADS_DISALLOW()      #ifdef PIKE_DEBUG - #define ASSERT_THREAD_SWAPPED_IN() do { \ +  + #define ASSERT_THREAD_SWAPPED_IN() do { \    struct thread_state *_tmp=thread_state_for_id(th_self()); \ -  if(_tmp->swapped) fatal("Thread is not swapped in!\n"); \ +  if(_tmp->swapped) fatal("Thread is not swapped in!\n"); \    }while(0)    -  + #ifdef __NT__ + #define TRYLOCK_INTERPRETER_LOCK() do {} while (0)   #else -  + #define TRYLOCK_INTERPRETER_LOCK() do { \ +  if (th_running && !mt_trylock(&interpreter_lock)) \ +  fatal("Haven't got interpreter lock.\n"); \ + } while (0) + #endif +  + #define CHECK_INTERPRETER_LOCK() do { \ +  if (th_running) { \ +  THREAD_T self; \ +  TRYLOCK_INTERPRETER_LOCK(); \ +  self = th_self(); \ +  if( thread_id && !th_equal( OBJ2THREAD(thread_id)->id, self) ) \ +  fatal("Current thread is wrong.\n"); \ +  } \ + } while (0) +  + #else +    #define ASSERT_THREAD_SWAPPED_IN() -  + #define CHECK_INTERPRETER_LOCK() do {} while (0) +    #endif      /* Prototypes begin here */   int low_nt_create_thread(unsigned Pike_stack_size,    unsigned (TH_STDCALL *func)(void *),    void *arg,    unsigned *id);   struct thread_starter;   struct thread_local;   void low_init_threads_disable(void);
pike.git/src/threads.h:632:   #define th_cleanup()   #define th_init_programs()   #define th_self() ((void*)0)   #define co_signal(X)   #define co_broadcast(X)      #define low_init_threads_disable()   #define init_threads_disable(X)   #define exit_threads_disable(X)    + #define TRYLOCK_INTERPRETER_LOCK() do {} while (0) + #define CHECK_INTERPRETER_LOCK() do {} while (0) +    #endif /* PIKE_THREADS */      #ifdef __NT__   #ifndef PIKE_DEBUG   #define CheckValidHandle(X) (X)   #else   HANDLE CheckValidHandle(HANDLE h);   #endif   #endif