Thread Timeout

Discussion in 'Ruby' started by Francesco Vollero, Jun 20, 2010.

  1. Hi list,

    i'm working with multiple threads, with a producer-consumer like algorithm.
    My problem is that i want that the "consumer" thread take all the
    content every *N* seconds and after go to "sleep" again, It's the
    Timeout library a good solution? I can use Ruby 1.9 and 1.8 as well.

    Thanks,
    Francesco Vollero
     
    Francesco Vollero, Jun 20, 2010
    #1
    1. Advertising

  2. On 20.06.2010 19:08, Francesco Vollero wrote:
    > i'm working with multiple threads, with a producer-consumer like algorithm.
    > My problem is that i want that the "consumer" thread take all the
    > content every *N* seconds and after go to "sleep" again,


    Why do you want to do that? If you want to schedule activity with
    particular intervals then I believe a scheduling solution would be
    better. In a simplistic solution you can have the main thread sleep for
    the interval and create a thread for each task.

    Kind regards

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
     
    Robert Klemme, Jun 20, 2010
    #2
    1. Advertising

  3. Il 20/06/10 19.50, Robert Klemme ha scritto:
    > On 20.06.2010 19:08, Francesco Vollero wrote:
    >> i'm working with multiple threads, with a producer-consumer like
    >> algorithm.
    >> My problem is that i want that the "consumer" thread take all the
    >> content every *N* seconds and after go to "sleep" again,

    >
    > Why do you want to do that? If you want to schedule activity with
    > particular intervals then I believe a scheduling solution would be
    > better. In a simplistic solution you can have the main thread sleep
    > for the interval and create a thread for each task.
    >
    > Kind regards
    >
    > robert
    >

    Robert, a draft example ?
     
    Francesco Vollero, Jun 21, 2010
    #3
  4. On 21.06.2010 02:59, Francesco Vollero wrote:
    > Il 20/06/10 19.50, Robert Klemme ha scritto:
    >> On 20.06.2010 19:08, Francesco Vollero wrote:
    >>> i'm working with multiple threads, with a producer-consumer like
    >>> algorithm.
    >>> My problem is that i want that the "consumer" thread take all the
    >>> content every *N* seconds and after go to "sleep" again,

    >>
    >> Why do you want to do that? If you want to schedule activity with
    >> particular intervals then I believe a scheduling solution would be
    >> better. In a simplistic solution you can have the main thread sleep
    >> for the interval and create a thread for each task.
    >>

    > Robert, a draft example ?


    You go first. ;-) You did not yet describe what kind of problem you are
    trying to solve.

    Btw, sleeping and starting threads isn't that hard.

    Cheers

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
     
    Robert Klemme, Jun 21, 2010
    #4
    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. Bob Johnson
    Replies:
    0
    Views:
    3,824
    Bob Johnson
    Aug 7, 2003
  2. Do
    Replies:
    2
    Views:
    6,451
  3. Guoqi Zheng
    Replies:
    4
    Views:
    13,123
    Guoqi Zheng
    Jun 3, 2004
  4. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,355
    Brian Candler
    Oct 6, 2004
  5. Charles Oliver Nutter
    Replies:
    43
    Views:
    664
    Roger Pack
    Mar 25, 2008
Loading...

Share This Page