From e4637a0a82cccf899e4f614c4c22ff70a1b387ff Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 29 May 2002 14:59:48 +0000 Subject: [PATCH] Some cleanups, more debugging info Original commit message from CVS: Some cleanups, more debugging info --- gst/cothreads.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gst/cothreads.c b/gst/cothreads.c index c0cf7b67dd..88be0041d1 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -33,6 +33,7 @@ #include "cothreads.h" #include "gstarch.h" #include "gstlog.h" +#include "gstutils.h" #define STACK_SIZE 0x200000 @@ -86,7 +87,7 @@ cothread_context_init (void) memset (ctx->threads, 0, sizeof (ctx->threads)); - ctx->threads[0] = (cothread_state *) g_malloc (sizeof (cothread_state)); + ctx->threads[0] = (cothread_state *) g_malloc0 (sizeof (cothread_state)); ctx->threads[0]->ctx = ctx; ctx->threads[0]->threadnum = 0; ctx->threads[0]->func = NULL; @@ -491,21 +492,22 @@ cothread_switch (cothread_state * thread) #endif enter = setjmp (current->jmp); if (enter != 0) { - GST_DEBUG (0, "enter thread #%d %d %p<->%p (%d)", current->threadnum, enter, - current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp); + GST_DEBUG (0, "enter thread #%d %d %p<->%p (%d) %p", current->threadnum, enter, + current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp, current->jmp); return; } - GST_DEBUG (0, "exit thread #%d %d %p<->%p (%d)", current->threadnum, enter, - current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp); + GST_DEBUG (0, "exit thread #%d %d %p<->%p (%d) %p", current->threadnum, enter, + current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp, current->jmp); enter = 1; - if (current->flags & COTHREAD_DESTROYED) + if (current->flags & COTHREAD_DESTROYED) { cothread_destroy (current); + } GST_DEBUG (0, "set stack to %p", thread->sp); /* restore stack pointer and other stuff of new cothread */ if (thread->flags & COTHREAD_STARTED) { - GST_DEBUG (0, "in thread "); + GST_DEBUG (0, "in thread %p", thread->jmp); /* switch to it */ longjmp (thread->jmp, 1); }