I have looked over your code during the weekend. I
understand the idea but not all the syntax though.
In our $TELNETS ||= 10;, what does " || " do?
And this: select undef, undef, undef, rand 1; ?
In $Q->enqueue( join( $, || '', @_ ) );, $ stands for the joining character and @_ is the arguments. But what is " || " and " '' " doing there?
I'm not lacy, just couldn't find that type of syntax in my Perl litterature. I have Perl CD bookshelf (E-book) and Perl-power (hardcopy) amongst other.
Other than that, it looks good. I have to inherit a skeleton class IO::Handle but leave the major methods blank. Hope telnet-socket only require writing to handle or this whole thing will not work easilly.
It will not work as good if telnet-socket is writing
in char-by-char fashion instead of line-by-line. I can check that out later.
This is the behaviour I had in mind for the code your supplied:
I use the main (GUI) thread to create a tie to the thread::queue as you have done.
Main-thread starts a new telnet-thread and passes that tied queue. Telnet-thread creates a socket with logging to tied-filehandle. Then command-execution to the telnet-socket starts (and later ends) while logging occur.
Main-thread then starts a Update-thread that uses the tied-handle to save logging to file and calls a callback function that output the logging to the right GUI window.
For that to work, all the telnet threads must print tagged-messages to tied-handle so I can separate them in my Update()-thread and output them to the right file and window.
So my program will have.
Main-thread may start another telnet-thread when user gives some appropriate GUI command. (So they don't start at the same time). The number of telnet-threads is limited by the number of hardware access points.
This is not so different to your behaviour description and it looks promising. By the way, I got the message "A thread exited while 2 threads were running." while I ran your code. It was not an error so I was not to bad.
Thanks, for redirecting me. Hope it works out for me now :)
In reply to Re^6: Problem with using threads with modules.
by tele2mag
in thread Problem with using threads with modules.
by tele2mag
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |