Thread for scheduling

C

csjasnoch

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?
 
A

Ara.T.Howard

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?

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
--
===============================================================================
| 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
===============================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,177
Messages
2,570,953
Members
47,507
Latest member
codeguru31

Latest Threads

Top