Steve: Thanks for the example code. I think I am doing something similar.
I have stub threads running along with my Wx code and I'm passing data and flags via a shared Hash. Now I need to move the function code from the event/timer handlers into the stubs. Probably another day or so of trial and error and error and error... It's a good thing the compiler is fast and it's not the old punch card days... I'll post the code when it's working again. Jim On Sun, Sep 27, 2015 at 8:27 AM, Steve Cookson <steve.cook...@sca-uk.com> wrote: > Hi James, > > On 24/09/15 18:13, James Lynes wrote: > >> Based on your comments I went and read the Perl Threads tutorial and >> searched Perl Monks for Wx and Threads(very little there). Also no working >> example on the wxPerl Wiki. >> >> I think Threads and Threads::Shared with lock() is the way to go. Now I >> just have to go figure it out! >> > You'll still need wx::Timer to keep on checking the status of your threads. > > Here are some snippets from my code, $gl_media_thread_hsh is a global > variable. I hope you can make sense of it. If you need more detail, > please just ask. > > # import libraries > use threads (); # Used for > multi-tasking ffmpeg > use threads::shared; > > # Check operation > > if ($value->is_running ne "1") { # Check > status and if not executing:- > my $result = $gl_media_thread_hsh->{$key}->join(); > # - collect result. > > > > # Post next thread > > $gl_media_thread_hsh->{$thread_no} = threads->new( > sub { > my $result = 0; > $result = $next_job->execute() if -e > $next_job->{input_file}; # trigger job in background. > return $result; > } > ); > $i_queue->post_new_job($loc_hash_count_int); # > Increment next available thread. > > Regards > > Steve. >