Hi all,
I'm writing a perl Win32::GUI program.This program using multithreads, multithreads running is fine.i'm using Thread::Pool::Simple module for the multithreads.And using thread::shared for data sharing.Share is required for subroutines, so far everything is fine.Program when to use 2th subroutine for the print the array to screen, GUI crashes so GUI not wait the thread or not print array element;
System: Perl version (v5.12.4) built for MSWin32-x86-.. Binary build 1205 294981
Windows 7
Thank you, Regards.use Win32::GUI; use threads; use threads::shared; my @SHARED; share(@SHARED); (...) &GET(@otherdata); #example (...) #1th subroutine sub GET { @data = @_; (...) sub workder { $data_2 = shift; (...) (...) for(...){ push(@SHARED, $_); } (...) } my $pool2 = Thread::Pool::Simple->new( min => 3, max => 20, do => [\&workder] ); foreach $getdatas (@data) { (...) } $pool2->join(); (...) &GET_2(); } #2th subroutine sub GET_2 { print $_,"\n" for @SHARED; #@SHARED not printing to screen }
In reply to thread::share problem by merlol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |