pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:160:    int swapped;    struct svalue *sp,*evaluator_stack;    struct svalue **mark_sp,**mark_stack;    struct frame *fp;    int evaluator_stack_malloced;    int mark_stack_malloced;    JMP_BUF *recoveries;    struct object * thread_id;   };    + /* Define to get a debug-trace of some of the threads operations. */ + /* #define VERBOSE_THREADS_DEBUG */ +  + #ifndef VERBOSE_THREADS_DEBUG + #define THREADS_FPRINTF(X) + #else + #define THREADS_FPRINTF(X) fprintf X + #endif /* VERBOSE_THREADS_DEBUG */ +    #define THREADS_ALLOW() \    do {\    struct thread_state _tmp; \    _tmp.swapped=0; \    if(num_threads > 1 && !threads_disabled) { \    _tmp.swapped=1; \    _tmp.sp=sp; \    _tmp.evaluator_stack=evaluator_stack; \    _tmp.mark_sp=mark_sp; \    _tmp.mark_stack=mark_stack; \    _tmp.fp=fp; \    _tmp.recoveries=recoveries; \    _tmp.evaluator_stack_malloced=evaluator_stack_malloced; \    _tmp.mark_stack_malloced=mark_stack_malloced; \    _tmp.thread_id = thread_id; \ - /* fprintf(stderr, "THREADS_ALLOW() %s:%d", __FILE__, __LINE__);*/\ +  THREADS_FPRINTF((stderr, "THREADS_ALLOW() %s:%d t:%08x\n", \ +  __FILE__, __LINE__, (unsigned int)_tmp.thread_id)); \    mt_unlock(& interpreter_lock); \    /*th_yield();*/\ - /* fprintf(stderr, "\n");*/\ +     }      #define THREADS_DISALLOW() \    if(_tmp.swapped) { \ - /* fprintf(stderr, "THREADS_DISALLOW() %s:%d ... ", __FILE__, __LINE__);*/\ +     mt_lock(& interpreter_lock); \ - /* fprintf(stderr, "\n");*/\ +  THREADS_FPRINTF((stderr, "THREADS_DISALLOW() %s:%d ... t:%08x\n", \ +  __FILE__, __LINE__, (unsigned int)_tmp.thread_id)); \    sp=_tmp.sp; \    evaluator_stack=_tmp.evaluator_stack; \    mark_sp=_tmp.mark_sp; \    mark_stack=_tmp.mark_stack; \    fp=_tmp.fp; \    recoveries=_tmp.recoveries; \    evaluator_stack_malloced=_tmp.evaluator_stack_malloced; \    mark_stack_malloced=_tmp.mark_stack_malloced; \    thread_id = _tmp.thread_id; \    } \