pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:1:   /* -  * $Id: threads.h,v 1.88 2000/04/21 23:07:10 hubbe Exp $ +  * $Id: threads.h,v 1.89 2000/04/23 03:01:26 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:50:   #undef HAVE_SPROC   #endif /* _SGI_SPROC_THREADS */         extern int num_threads;   extern int live_threads;   struct object;   extern size_t thread_stack_size;   extern struct object *thread_id;    - /* Used by debug code. Avoid pulling in gc.h only for this. */ - extern int Pike_in_gc; -  +    #define DEFINE_MUTEX(X) PIKE_MUTEX_T X         #ifdef POSIX_THREADS      #ifdef HAVE_PTHREAD_ATFORK   #define th_atfork(X,Y,Z) pthread_atfork((X),(Y),(Z))   #define th_atfork_prepare()   #define th_atfork_parent()   #define th_atfork_child()
pike.git/src/threads.h:497:   #endif /* PIKE_DEBUG */      #define OBJ2THREAD(X) \    ((struct thread_state *)((X)->storage+thread_storage_offset))      #define THREADSTATE2OBJ(X) BASEOF((X),object,storage[thread_storage_offset])      #define THREADS_ALLOW() do { \    struct thread_state *_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 >=100 && Pike_in_gc <300) \ +  if (Pike_in_gc >= 100 && Pike_in_gc != 300 && Pike_in_gc != 500) \    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", \    __FILE__, __LINE__, \    (unsigned int)_tmp->thread_id, live_threads)); \    mt_unlock_interpreter(); \    } else {} \    HIDE_GLOBAL_VARIABLES()
pike.git/src/threads.h:532:    } \    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); \    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 >=100 && Pike_in_gc <300) \ +  if (Pike_in_gc >= 100 && Pike_in_gc != 300 && Pike_in_gc != 500) \    fatal("Threads allowed during garbage collection.\n"); \    }) \    if(num_threads > 1 && !threads_disabled) { \    SWAP_OUT_THREAD(_tmp_uid); \    live_threads++; \    THREADS_FPRINTF(1, (stderr, "THREADS_ALLOW_UID() %s:%d t:%08x(#%d)\n", \    __FILE__, __LINE__, \    (unsigned int)_tmp_uid->thread_id, live_threads)); \    mt_unlock_interpreter(); \    } else {} \