Thread for scheduling

(csjasnoch@wisc.edu) #1

I would like to be able to create a thread that uses a schedule
(located in a file) and continues to run and do a system call when the
time is right. I have most of it implimented but I am having a problem
keeping the main interface active while allowing the 2nd thread (my
system caller) to still function at the correct time.

I have a Tk interface that upon the click of a start button, will start
an already created and stopped thread.

I am use thread.run to do this. However, if I do not use thread.join
afterwards it seems that the thread goes to sleep as I want it to, but
then never wakes up:(

If I use thread.join it does everything fine, but my main process (the
user interface) is locked and can not do anything.

So how can I make it so my interface is still active and my secondary
thread is running in the background doing the system calls when the
time is right?

(Ara.T.Howard) #2

this is __exactly__ what i wrote session for - to allow a gui thread to run
background commands in a way that does not block the calling thread. so,
__assuming__ your threaded programming is right try

   require 'session'

   Session::new do |sh|
     stdout, stderr, sh.execute command
     status = sh.status
   end

to run your commands in thread. session is on the raa.

hth.

-a

···

On Sat, 3 Sep 2005, csjasnoch@wisc.edu wrote:

I would like to be able to create a thread that uses a schedule (located in
a file) and continues to run and do a system call when the time is right. I
have most of it implimented but I am having a problem keeping the main
interface active while allowing the 2nd thread (my system caller) to still
function at the correct time.

I have a Tk interface that upon the click of a start button, will start an
already created and stopped thread.

I am use thread.run to do this. However, if I do not use thread.join
afterwards it seems that the thread goes to sleep as I want it to, but then
never wakes up:(

If I use thread.join it does everything fine, but my main process (the user
interface) is locked and can not do anything.

So how can I make it so my interface is still active and my secondary >
thread is running in the background doing the system calls when the time is
right?

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death
Like a lamp standing in a strong breeze. --Nagarjuna

===============================================================================