- Updated colorization some more (pthread and cothread id is in color)

Original commit message from CVS:
- Updated colorization some more (pthread and cothread id is in color)
- Added some minor debug to help trace mp1vid segfaults
This commit is contained in:
Erik Walthinsen 2001-04-28 04:23:27 +00:00
parent 7fdca5f428
commit 86027bd86f
4 changed files with 23 additions and 9 deletions

View file

@ -54,6 +54,11 @@ cothread_init (void)
{
cothread_context *ctx = (cothread_context *)malloc(sizeof(cothread_context));
// we consider the initiating process to be cothread 0
ctx->nthreads = 1;
ctx->current = 0;
ctx->data = g_hash_table_new(g_str_hash, g_str_equal);
GST_INFO (GST_CAT_COTHREADS,"initializing cothreads");
if (_cothread_key == -1) {
@ -85,11 +90,6 @@ cothread_init (void)
GST_INFO (GST_CAT_COTHREADS,"0th thread is %p at sp:%p",ctx->threads[0], ctx->threads[0]->sp);
// we consider the initiating process to be cothread 0
ctx->nthreads = 1;
ctx->current = 0;
ctx->data = g_hash_table_new(g_str_hash, g_str_equal);
return ctx;
}
@ -345,7 +345,7 @@ cothread_switch (cothread_state *thread)
#ifdef COTHREAD_PARANOID
nothread:
g_print("cothread: there's no thread, strange...\n");
g_print("cothread: can't switch to NULL cothread!\n");
return;
nocontext:
g_print("cothread: there's no context, help!\n");

View file

@ -68,6 +68,15 @@ static gchar *_gst_info_category_strings[] = {
"NEGOTIATION",
};
/*
* Attribute codes:
* 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
* Text color codes:
* 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
* Background color codes:
* 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
*/
const gchar *_gst_category_colors[32] = {
[GST_CAT_GST_INIT] = "07;37",
[GST_CAT_COTHREADS] = "00;32",
@ -129,8 +138,10 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
{
gchar *empty = "";
gchar *elementname = empty,*location = empty;
int pthread_id = getpid();
int cothread_id = cothread_getcurrent();
#ifdef GST_DEBUG_COLOR
int pthread_color = pthread_id%6 + 31;
int cothread_color = (cothread_id < 0) ? 37 : (cothread_id%6 + 31);
#endif
@ -142,11 +153,12 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
#ifdef GST_DEBUG_ENABLED
#ifdef GST_DEBUG_COLOR
fprintf(stderr,"INFO(%d:\033[00;%dm%d\033[00m):\033[" GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n",
getpid(),cothread_color,cothread_id,
fprintf(stderr,"INFO (\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m):\033["
GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n",
pthread_color,pthread_id,cothread_color,cothread_id,
_gst_category_colors[category],location,elementname,string);
#else
fprintf(stderr,"INFO(%d:%d):%s%s %s\n",
fprintf(stderr,"INFO (%5d:%2d):%s%s %s\n",
getpid(),cothread_id,location,elementname,string);
#endif /* GST_DEBUG_COLOR */
#else

View file

@ -153,6 +153,7 @@ gst_queue_init (GstQueue *queue)
queue->emptycond = g_cond_new ();
queue->fullcond = g_cond_new ();
GST_DEBUG(GST_CAT_THREAD, "initialized queue's emptycond and fullcond\n");
}
static GstBufferPool*

View file

@ -153,6 +153,7 @@ gst_queue_init (GstQueue *queue)
queue->emptycond = g_cond_new ();
queue->fullcond = g_cond_new ();
GST_DEBUG(GST_CAT_THREAD, "initialized queue's emptycond and fullcond\n");
}
static GstBufferPool*