Re: GStreamer Threading => "Segmentation fault"



On Sat, 2005-05-14 at 15:45 +0200, Matthias Bläsing wrote:

When running this small example it just segfaults (when calling the
mainloop) and I don't now why. Am I right if I asume, that perl messes
with the thread handling?

Yeah, perl is not reentrant, so whenever two threads call something in
one perl instance you get nasty results.  In this case it was because
perl tried to print a warning message.

However, if you avoid those pitfalls, threading can work.  In this case,
it's your script that's buggy.  You create two threads, add the source,
the decoder and the queue to the first one and the sink to the second
one, link all of them together and start both threads.  Apparently,
that's not how it's supposed to be done.

This approach works: Create two threads.  Add the source, the decoder
and the queue to the first thread.  Add the sink to the second thread.
Add the second thread to the first thread.  Link everything together.
Start the first thread.  Enter the main loop.

The attached script implements this.

What's not relatet to thread is, the I changed the Threads to pipelines
and tried to Iterate over the to pipe by hand:
while(1) {
      $thread1->iterate();
      $thread2->iterate();
}

See the two commented out lines in the attached script for how this can
be done.

-- 
Bye,
-Torsten

Attachment: thread-test.pl
Description: Perl program



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]