Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Thread for scheduling

Reply
Thread Tools

Thread for scheduling

 
 
csjasnoch@wisc.edu
Guest
Posts: n/a
 
      09-02-2005
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?

 
Reply With Quote
 
 
 
 
Ara.T.Howard
Guest
Posts: n/a
 
      09-02-2005
On Sat, 3 Sep 2005, http://www.velocityreviews.com/forums/(E-Mail Removed) 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?


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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
thread scheduling question Jeffrey Flint Ruby 0 01-09-2008 03:33 AM
thread scheduling Mark Volkmann Ruby 5 01-11-2006 04:29 PM
passing messages between ruby thread and scheduling vincent Ruby 0 06-22-2005 03:57 AM
weird delay of UDP server (seems to be thread-scheduling issue) chris guenther Ruby 0 04-10-2005 06:21 PM
ASP Thread Scheduling Anomalies Tony Proctor ASP General 6 03-16-2005 04:59 PM



Advertisments