for (slot = 1; slot < ctx->nthreads; slot++) {
if (ctx->threads[slot] == NULL)
break;
- else if (ctx->threads[slot]->flags & COTHREAD_DESTROYED) {
+ else if (ctx->threads[slot]->flags & COTHREAD_DESTROYED &&
+ slot != ctx->current) {
cothread_destroy (ctx->threads[slot]);
break;
}
{
g_return_if_fail (thread != NULL);
- GST_INFO (GST_CAT_COTHREADS, "flag cothread for destruction");
+ GST_INFO (GST_CAT_COTHREADS, "flag cothread %d for destruction", thread->threadnum);
/* we simply flag the cothread for destruction here */
thread->flags |= COTHREAD_DESTROYED;
g_return_if_fail (thread != NULL);
- GST_INFO (GST_CAT_COTHREADS, "destroy cothread");
+ GST_INFO (GST_CAT_COTHREADS, "destroy cothread %d %p %p", thread->threadnum, thread, ctx->current);
ctx = thread->ctx;
#ifndef COTHREAD_ATOMIC
+ g_mutex_unlock (thread->lock);
g_mutex_free (thread->lock);
#endif
//munmap ((void *) thread, COTHREAD_STACKSIZE);
}
#endif /* GST_DISABLE_LOADSAVE */
+void
+gst_element_yield (GstElement *element)
+{
+ if (GST_ELEMENT_SCHED (element)) {
+ gst_scheduler_yield (GST_ELEMENT_SCHED (element), element);
+ }
+}
+
+void
+gst_element_interrupt (GstElement *element)
+{
+ if (GST_ELEMENT_SCHED (element)) {
+ gst_scheduler_interrupt (GST_ELEMENT_SCHED (element), element);
+ }
+}
+
/**
* gst_element_set_sched:
* @element: Element to set manager of.
void gst_element_set_parent (GstElement *element, GstObject *parent);
GstObject* gst_element_get_parent (GstElement *element);
-#define gst_element_yield(element) gst_scheduler_yield(GST_ELEMENT_SCHED(element),element)
-#define gst_element_interrupt(element) gst_scheduler_interrupt(GST_ELEMENT_SCHED(element),element)
+void gst_element_yield (GstElement *element);
+void gst_element_interrupt (GstElement *element);
void gst_element_set_sched (GstElement *element, GstScheduler *sched);
GstScheduler* gst_element_get_sched (GstElement *element);
gst_pad_set_caps (pad, caps);
-{ /* FIXME: this should all be in an _emit() wrapper eventually */
- int oldstate = GST_STATE(typefind);
- gst_object_ref (GST_OBJECT (typefind));
- g_signal_emit (G_OBJECT (typefind), gst_typefind_signals[HAVE_TYPE], 0,
+ {
+ int oldstate = GST_STATE(typefind);
+ gst_object_ref (GST_OBJECT (typefind));
+ g_signal_emit (G_OBJECT (typefind), gst_typefind_signals[HAVE_TYPE], 0,
typefind->caps);
- if (GST_STATE(typefind) != oldstate) {
+ if (GST_STATE(typefind) != oldstate) {
+ GST_DEBUG(0, "state changed during signal, aborting\n");
+ gst_element_yield (GST_ELEMENT (typefind));
+ }
gst_object_unref (GST_OBJECT (typefind));
- GST_DEBUG(0, "state changed during signal, aborting\n");
- gst_element_yield (typefind);
- }
- gst_object_unref (GST_OBJECT (typefind));
-}
- goto end;
+ goto end;
+ }
}
factories = g_slist_next (factories);
}