Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^5: Thread implementation for Win32::GUI

by Corion (Pope)
on Mar 28, 2013 at 08:25 UTC ( #1025891=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Thread implementation for Win32::GUI
in thread Thread implementation for Win32::GUI

I recommend the following setup:

use strict; use threads; use Thread::Queue; my $remote_commands= Thread::Queue->new; my $status= Thread::Queue->new; # responses sub worker { $status->enqueue('Connecting to host'); require Net::Telnet; ... connect to host while (defined(my $cmd= $remote_commands->dequeue)) { $status->enqueue("Running [$cmd]"); $telnet->print($cmd); }; }; my $worker= threads->new( \&worker ); ... sub btQuery_Click { # ... send commands to queue $remote_commands->enqueue("cd /"); $remote_commands->enqueue("echo 'Hello World'"); ... };


Comment on Re^5: Thread implementation for Win32::GUI
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-07-25 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls