# Thread Timeout

**URL:** <https://www.ruby-forum.com/t/thread-timeout/190446>\
**Category:** Ruby\
**Created:** [June 20, 2010, 7:08pm UTC](https://www.ruby-forum.com/t/thread-timeout/190446 "2010-06-20T19:08:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pollopoop92](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@pollopoop92](https://www.ruby-forum.com/u/pollopoop92)\
**Post date:** [June 20, 2010, 7:08pm UTC](https://www.ruby-forum.com/t/thread-timeout/190446/1 "2010-06-20T19:08:37Z")

</div>

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 V.

---

<div class="post-metadata">

**Author:** ![pollopoop92](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@pollopoop92](https://www.ruby-forum.com/u/pollopoop92)\
**Post date:** [June 20, 2010, 7:50pm UTC](https://www.ruby-forum.com/t/thread-timeout/190446/2 "2010-06-20T19:50:46Z")

</div>

On 20.06.2010 19:08, Francesco V. 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

---

<div class="post-metadata">

**Author:** ![pollopoop92](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@pollopoop92](https://www.ruby-forum.com/u/pollopoop92)\
**Post date:** [June 21, 2010, 2:59am UTC](https://www.ruby-forum.com/t/thread-timeout/190446/3 "2010-06-21T02:59:49Z")

</div>

Il 20/06/10 19.50, Robert K. ha scritto:

> Kind regards
> 
> ```
> robert
> 
> ```

Robert, a draft example ?

---

<div class="post-metadata">

**Author:** ![pollopoop92](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@pollopoop92](https://www.ruby-forum.com/u/pollopoop92)\
**Post date:** [June 21, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/thread-timeout/190446/4 "2010-06-21T18:51:02Z")

</div>

On 21.06.2010 02:59, Francesco V. wrote:

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