0

I'm creating a threaded program where not all threads are spawned at the beginning. Some have to wait for 1 or more threads to complete first. This would not be a problem, except I would like to keep the xterms open to read through the output. In some cases, piping to a file does not work as there is some fancy stuff going on with the terminal output where it overwrites itself.

I have been using my $xt_hold = "xterm -sl 5000 -geometry 350x50+0+100 -iconic -hold -e $cmd"; system($xt_hold); to create the xterm but this does not allow me to join the thread when it is finished. Is there another way I can keep the xterm open and know when/join the thread when it is finished?

If there is a better solution using GNU screen then I would probably be interested in that, but my primary choice would be xterm just because I am more familiar with it.

4

2 回答 2

0

I recommend you to use another approach: queue.

Using Thread::Queue you can tell each working threads to place results into the queue. Another thread (created for output) will read from the queue and output it to the terminal (or file, or DB etc.).

于 2013-10-29T01:56:29.237 回答
0

While trying to answer this, I realized something. The characters that were showing up in the text files were control characters for color and I guess there are also delete/backspace ones. These can only be interpreted by terminals, so I can just view the logfiles in the original terminal with less -r.

于 2014-02-08T01:05:22.420 回答