Hi Johan,

one important thing is to 'use threads' before you 'use Wx'.

Do you get the core dumps when creating the threads or when trying to
join them?

I had some pain with threads in Wx, too. My issue was a bug(?) in Wx
2.8: I was assigning an ImageList to an widget more than once. Bad idea.
After that, the applications kept stable until I tried to start some
threads. It was really a pain to find out the root-cause of the core
dumps. Then I had another issue with a very complex data-structure with
many cross-references. That also seems to be an issue for Wx, for
whatever reason.

If you're not using Wx::PlThreadEvent events, threads work straight
forward as usual:

use threads;
use Wx;

...

my $thread = threads->create( sub { do something } )

$thread->join();

You shoudn't detach them. This also caused some core-dumps in my
application.

Besides that, threads are working pretty well. I am also using
Thread::Queue and shifting big amounts of data around. All works stable.

For the usage with Wx::PlThreadEvent there is a good example in the POD.

Cheers,
Markus


Am 31.05.2013 10:14, schrieb Johan Vromans:
> Hi,
> 
> I'm trying to use threads from a Wx program. Unfortunately, the only
> results I get so far are core dumps. Apparently I'm doing something
> wrong.
> 
> To improve my understanding how this works, does anyone have a simple
> working example of a wxPerl program that uses threads?
> 
> Thanks,
> 
> -- Johan
> 

Reply via email to