miked63017 has asked for the wisdom of the Perl Monks concerning the following question:
Hello this is my first post and I am kind of new so let me know what I am doing wrong(I am sure theres something). Basically I am writing some scripts for optical remote (across the office) drive testing. I got a simple client server setup. I would like to use threads to minimize the amount of commands I must pass through. Right now there are 6 remote machines running the server script along with some other scripts. However I do not like opening 6 client windows on the main controlling computer. I would like to open one window that gathers the ip addresses from a config file which I already have a firm grasp on. The output from the servers I would like to use threads but I dont want all of it scrolling in one window. I would like each thread to open its own window and still be able to pass data to the parent and/or server. Short version I want each thread to open in a new window. I have searched the first ten pages of google which usually can help me hack something together but not this time. I am using opensuse so linux solutions are appreciated.
Thanks
Re: Threads Help
by wazoox (Prior) on May 06, 2011 at 21:37 UTC
|
What did you write so far? What about starting with a simple, one machine controller, then expanding it? Do you have any code to show? You really don't give much meaningful detail...
| [reply] |
|
I named my script CFDeluxe for Cluster F*** Deluxe. So rather than you combing through my spaghetti code. I just need an example of threads where each thread opens in a new console although I am starting to get the feeling this is not possible
| [reply] |
|
On Linux, each console (let's say xterm to keep it simple) is an independent process, and is connected to its own pty (pseudo tty). You can open an xterm with a special command (as opposed as running a shell). If you want to display data coming from a thread to your xterm, you could use named pipes (created with mkfifo); the working thread could write to the named pipe, and the script run from the xterm would display what's coming into the named pipe.
I don't have any code at hand for an example, but it's quite easy to do.
| [reply] |
Re: Threads Help
by NetWallah (Canon) on May 07, 2011 at 04:55 UTC
|
I wrote this simple thread usage module several years ago - You should be able to use it to meet your requirements.
The basic idea is that you have a work queue, workers , and a result queue.
Feed work to the workers - they do their thing, and return results.
Syntactic sugar causes cancer of the semicolon. --Alan Perlis
| [reply] |
Re: Threads Help
by BrowserUk (Patriarch) on May 06, 2011 at 23:49 UTC
|
What kind of "windows" do you mean? (ie. console; gui, other)?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
|
| [reply] |
|
Sorry, I cannot help you. I don't know if it is even possible to have multiple consoles associated with a single process under *nix.
I know it isn't possible to do so under Windows. Multiple processes can share a console, and a process can have multiple console buffers, but each process can only be associated with a single console.
Maybe this is a common restriction.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |