Branch: Tag:

2000-04-14

2000-04-14 15:23:45 by Martin Stjernholm <mast@lysator.liu.se>

Some debug. Something is fishy if threads are enabled during gc..

Rev: src/gc.c:1.60
Rev: src/gc.h:1.27
Rev: src/threads.h:1.79

1:   /* -  * $Id: threads.h,v 1.78 2000/03/30 04:39:17 hubbe Exp $ +  * $Id: threads.h,v 1.79 2000/04/14 15:23:45 mast Exp $    */   #ifndef THREADS_H   #define THREADS_H
57:   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      
463:      #define THREADS_ALLOW() do { \    struct thread_state *_tmp=OBJ2THREAD(thread_id); \ -  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) ; ) \ +  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); \ +  if (Pike_in_gc == 1) \ +  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", \
494:      #define THREADS_ALLOW_UID() do { \    struct thread_state *_tmp_uid=OBJ2THREAD(thread_id); \ +  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); \ +  if (Pike_in_gc == 1) \ +  fatal("Threads allowed during garbage collection.\n"); \ +  }) \    if(num_threads > 1 && !threads_disabled) { \    SWAP_OUT_THREAD(_tmp_uid); \    live_threads++; \