Hello Robert,

Friday, June 18, 2004, 12:54:37 PM, Robert Friberg wrote:

RF> Excerpt from perlthrtut:

RF> The ideal way to reduce these costs is to have a
RF> relatively short number of long-lived threads, all created fairly early on -
RF> before the base thread has accumulated too much data.


good, I am trying to do this way: creating a worker-thread without modules
in BEGIN{} block. The problem is how can main programm and this thread
communicate with each other and share variables, arrays and hashes?
Using shared variables not working for me. I have something like this:

BEGIN{
    use strict;
    use threads;
    use threads::shared;
    use warnings;

    threads->new("worker");  #

    sub worker {
        while (1) {
            # do something
            sleep(1);
        }
    }

}
use strict;
use warnings;
use Win32::Internet;  # some modules
use DBI;
use Win32::Clipboard;
use MIME::Base64;
use Compress::Zlib;
use Win32;
use Win32::Sound;
use Tie::IxHash;
while(1){
    # do something
    sleep 1;
}
-- 
Best regards,
 du4mi                            mailto:[EMAIL PROTECTED]

Reply via email to