From fddb92b5e29f95a1ae78ce4b79f79807450ef036 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 29 May 2002 15:01:50 +0000 Subject: [PATCH] Error checking in pthread creation more info in gst_util_dump_mem Original commit message from CVS: Error checking in pthread creation more info in gst_util_dump_mem --- gst/gstthread.c | 6 +++++- gst/gstutils.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gst/gstthread.c b/gst/gstthread.c index 072d97d01a..555a7463f4 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -271,7 +271,11 @@ gst_thread_change_state (GstElement * element) g_mutex_lock (thread->lock); /* create the thread */ - pthread_create (&thread->thread_id, NULL, gst_thread_main_loop, thread); + if (pthread_create (&thread->thread_id, NULL, gst_thread_main_loop, thread) != 0) { + g_mutex_unlock (thread->lock); + THR_DEBUG ("could not create thread \"%s\"", GST_ELEMENT_NAME (element)); + return GST_STATE_FAILURE; + } /* wait for it to 'spin up' */ THR_DEBUG ("waiting for child thread spinup"); diff --git a/gst/gstutils.c b/gst/gstutils.c index d8cc40056f..5649114452 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -22,6 +22,7 @@ #include #include +#include #include "gst_private.h" #include "gstutils.h" @@ -213,7 +214,18 @@ gst_util_dump_mem (guchar * mem, guint size) i = j = 0; while (i < size) { if (j == 0) { - g_print ("\n%08x : ", i); + if (i != 0) { + guint k; + + for (k = i - 16; k < i; k++) { + if (isprint (mem[k])) + g_print ("%c", mem[k]); + else + g_print ("."); + } + g_print ("\n"); + } + g_print ("%08x : ", i); j = 15; } else {