From 7dcd7a13a1df12dc43aa02bf3913dd57b1fbb03e Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Wed, 27 Dec 2000 03:13:20 +0000 Subject: [PATCH] Mostly minor little changes, but two interesting things: 1) removed a pthread_join from the gst_thread_main_loop. co... Original commit message from CVS: Mostly minor little changes, but two interesting things: 1) removed a pthread_join from the gst_thread_main_loop. commented out because the thread isn't supposed to run pthread_join, the main process is. 2) Fixed a major bug with cothreads in threads. Had to add MAP_FIXED to the mmap() of the cothread stack. Presumably the gilbc that ships with redhat 7.0 now places these mmap requests somewhat randomly. Since they *must* be exactly where we expect them, it was failing. MAP_FIXED forces it to put it where we say. --- gst/Makefile.am | 2 -- gst/cothreads.c | 7 ++++--- gst/elements/Makefile.am | 2 -- gst/gstpipeline.c | 2 +- gst/gstthread.c | 2 +- gst/types/Makefile.am | 2 -- plugins/elements/Makefile.am | 2 -- 7 files changed, 6 insertions(+), 13 deletions(-) diff --git a/gst/Makefile.am b/gst/Makefile.am index 2fe397f..e64ac09 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -87,8 +87,6 @@ noinst_HEADERS = \ gsti386.h \ gstppc.h -CFLAGS += -g -O6 -Wall - libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS) libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) diff --git a/gst/cothreads.c b/gst/cothreads.c index a60d858..211d655 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -55,15 +55,16 @@ cothread_create (cothread_context *ctx) //if (0) { if (pthread_self() == 0) { s = (cothread_state *)malloc(sizeof(int) * COTHREAD_STACKSIZE); - DEBUG("new stack at %p\n",s); + DEBUG("new stack (case 1) at %p\n",s); } else { char *sp = CURRENT_STACK_FRAME; unsigned long *stack_end = (unsigned long *)((unsigned long)sp & ~(STACK_SIZE - 1)); s = (cothread_state *)(stack_end + ((ctx->nthreads - 1) * COTHREAD_STACKSIZE)); + DEBUG("new stack (case 2) at %p\n",s); if (mmap((char *)s,COTHREAD_STACKSIZE*(sizeof(int)), - PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_ANONYMOUS, + PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS, -1,0) < 0) { perror("mmap'ing cothread stack space"); return NULL; @@ -136,7 +137,7 @@ cothread_init (void) ctx->threads[0]->sp = (int *)CURRENT_STACK_FRAME; ctx->threads[0]->pc = 0; - DEBUG("0th thread is at %p %p\n",ctx->threads[0], ctx->threads[0]->sp); + DEBUG("0th thread is at %p, sp %p\n",ctx->threads[0], ctx->threads[0]->sp); // we consider the initiating process to be cothread 0 ctx->nthreads = 1; diff --git a/gst/elements/Makefile.am b/gst/elements/Makefile.am index bf57b27..ac3b284 100644 --- a/gst/elements/Makefile.am +++ b/gst/elements/Makefile.am @@ -42,7 +42,5 @@ noinst_HEADERS = \ gsttypefind.h \ gstsinesrc.h -CFLAGS += -O2 -Wall - libgstelements_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(GHTTP_LIBS) libgstelements_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index dbcdb22..cf5ea6f 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -113,7 +113,7 @@ gst_pipeline_init (GstPipeline *pipeline) GstElement* gst_pipeline_new (guchar *name) { - return gst_elementfactory_make ("bin", name); + return gst_elementfactory_make ("pipeline", name); } static void diff --git a/gst/gstthread.c b/gst/gstthread.c index 73561d3..b419743 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -309,7 +309,7 @@ gst_thread_main_loop (void *arg) } GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING); - pthread_join (thread->thread_id, 0); +// pthread_join (thread->thread_id, 0); gst_info("gstthread: thread \"%s\" is stopped\n", gst_element_get_name (GST_ELEMENT (thread))); diff --git a/gst/types/Makefile.am b/gst/types/Makefile.am index ff77ccc..3792906 100644 --- a/gst/types/Makefile.am +++ b/gst/types/Makefile.am @@ -8,7 +8,5 @@ libgsttypes_la_SOURCES = \ #noinst_HEADERS = -CFLAGS += -O2 -Wall - libgsttypes_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) libgsttypes_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) diff --git a/plugins/elements/Makefile.am b/plugins/elements/Makefile.am index bf57b27..ac3b284 100644 --- a/plugins/elements/Makefile.am +++ b/plugins/elements/Makefile.am @@ -42,7 +42,5 @@ noinst_HEADERS = \ gsttypefind.h \ gstsinesrc.h -CFLAGS += -O2 -Wall - libgstelements_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(GHTTP_LIBS) libgstelements_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) -- 2.7.4