This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

thread

Help for those learning Tcl or writing their own scripts.
Post Reply
h
haferbrei
Voice
Posts: 24
Joined: Wed Apr 08, 2020 8:57 pm

thread

Post by haferbrei »

I want to run a bash script that packs folders. This takes a little time and during this time the bot is not responsive.
How can I move the script to a thread?

Code: Select all

set zipper [thread::create {
puts "Starting zipper thread"
exec bash.script
}]
Unfortunately, this does not work.
w
willyw
Revered One
Posts: 1204
Joined: Thu Jan 15, 2009 12:55 am

Re: thread

Post by willyw »

haferbrei wrote: ...
How can I move the script to a thread?
...
I think there is a Thread package. However I am not familiar with it. Maybe someone else here will comment on it.

You're running into what is called: blocking.

I'm fuzzy on this - been a long time - but you can use the
open
command with pipes to deal with this.

No doubt you can use the search function here in the forum, and find lots on the open command.
Perhaps even something on that Thread package, too.

Here's one post that might interest you:
http://forum.egghelp.org/viewtopic.php?p=100611

I see a comment in some code there:

Code: Select all

...
# Description:
#
# This script is for other scripters to use as a replacement
# for the "exec" command so that they may execute commands to
# the system in the background. (non-blocking mode) 
...
which sure sounds like what you are looking for. :)

Have a read, and see if there is anything there of use to you.
I'm sorry that I can't give you a more direct answer.
I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
h
haferbrei
Voice
Posts: 24
Joined: Wed Apr 08, 2020 8:57 pm

Re: thread

Post by haferbrei »

willyw wrote:
I'm fuzzy on this - been a long time - but you can use the
open
command with pipes to deal with this.
i tried it with &, but it doesnt help at all. I get the message (!) timer drift -- spun 2 minutes
Post Reply