Error checking in pthread creation more info in gst_util_dump_mem
authorWim Taymans <wim.taymans@gmail.com>
Wed, 29 May 2002 15:01:50 +0000 (15:01 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 29 May 2002 15:01:50 +0000 (15:01 +0000)
Original commit message from CVS:
Error checking in pthread creation
more info in gst_util_dump_mem

gst/gstthread.c
gst/gstutils.c

index 072d97d..555a746 100644 (file)
@@ -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");
index d8cc400..5649114 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <ctype.h>
 
 #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 {