Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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'"); ... };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025891]
help
Chatterbox?
[ambrus]: Corion: no, backwards. It's possible in the general case, but not in the specific case of bad data we have. Which is why it's harder to explain.
[marto]: that reminds me, to donate...
[ambrus]: If it was possible in this specific case, then the burden to argue for that would be his.
[Corion]: ambrus: Ah, but he's the boss, so the burden to show that it's impossible still lies on you :-)
[Corion]: ambrus: I would work with him through an example

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2017-12-12 13:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (332 votes). Check out past polls.

    Notices?