Make sure a cothreaded element is selected as the first one to start the cothread_switch

Original commit message from CVS:
Make sure a cothreaded element is selected as the first one to start
the cothread_switch
This commit is contained in:
Wim Taymans 2001-02-28 21:40:03 +00:00
parent 18964cbfac
commit 0487371214

View file

@ -800,11 +800,27 @@ gst_bin_iterate_func (GstBin *bin)
if (!chain->need_scheduling) continue;
if (chain->need_cothreads) {
GList *entries;
// all we really have to do is switch to the first child
// FIXME this should be lots more intelligent about where to start
GST_DEBUG (0,"starting iteration via cothreads\n");
entry = GST_ELEMENT (chain->elements->data);
entries = chain->elements;
entry = NULL;
// find an element with a threadstate to start with
while (entries) {
entry = GST_ELEMENT (entries->data);
if (entry->threadstate)
break;
entries = g_list_next (entries);
}
// if we couldn't find one, bail out
if (entries == NULL)
GST_ERROR(GST_ELEMENT(bin),"no cothreaded elements found!");
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
GST_ELEMENT_NAME (entry),entry);