Thread for scheduling

Discussion in 'Ruby' started by csjasnoch@wisc.edu, Sep 2, 2005.

  1. Guest

    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?
     
    , Sep 2, 2005
    #1
    1. Advertising

  2. Ara.T.Howard Guest

    On Sat, 3 Sep 2005, 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
    ===============================================================================
     
    Ara.T.Howard, Sep 3, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Proctor

    ASP Thread Scheduling Anomalies

    Tony Proctor, Mar 2, 2005, in forum: ASP General
    Replies:
    6
    Views:
    277
    Tony Proctor
    Mar 16, 2005
  2. chris guenther
    Replies:
    0
    Views:
    116
    chris guenther
    Apr 10, 2005
  3. vincent
    Replies:
    0
    Views:
    172
    vincent
    Jun 22, 2005
  4. Mark Volkmann

    thread scheduling

    Mark Volkmann, Jan 10, 2006, in forum: Ruby
    Replies:
    5
    Views:
    129
    Lou Vanek
    Jan 11, 2006
  5. Jeffrey Flint

    thread scheduling question

    Jeffrey Flint, Jan 9, 2008, in forum: Ruby
    Replies:
    0
    Views:
    85
    Jeffrey Flint
    Jan 9, 2008
Loading...

Share This Page