# Threading example in FAQ 4.2 is slightly broken?

**URL:** <https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410>\
**Category:** Ruby\
**Created:** [April 21, 2006, 10:24am UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410 "2006-04-21T10:24:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 21, 2006, 10:24am UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/1 "2006-04-21T10:24:54Z")

</div>

Hi all,

I just ran the example at the end of FAQ 4.2

```
http://www.rubycentral.com/faq/rubyfaq-4.html#ss4.2

```

The FAQ text says this produces:

> onetwo: : 00
> 
> onetwo: : 11
> 
> onetwo: : 33

This confused me, so I ran the code and got:

> one: 0  
> two: 0  
> one: 1  
> two: 1  
> one: 3  
> two: 3

which made more sense. OK, so thread scheduling is nondetermininistic  
and there’s no mutual exclusion on stdout, so I can see how the output  
given in the FAQ entry _could_ happen - however, I think the version I  
saw demonstrates the FAQ’s point more clearly.

Who should I tell about this? Raise a bug? Or is raising the alarm  
hereabouts sufficient? 🙂

Thanks,

-Andy

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 21, 2006, 1:11pm UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/2 "2006-04-21T13:11:59Z")

</div>

On 4/21/06, Andy G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > one: 3  
> > Thanks,
> 
> -Andy
> 
> –  
> Andy G.  
> Computer Science Department  
> University of Wales Swansea  
> [http://www.cs.swan.ac.uk/~csandy/](http://www.cs.swan.ac.uk/~csandy/)
> 
> Hmm why don’t you drop a mail to the FAQ maintainer mailto:  
> removed\_email\_address@domain.invalid ?  
> Personally I fail to see the point of the example but that might just be  
> because I am tired.  
> Hope that helps  
> Robert  
> –  
> Deux choses sont infinies : l’univers et la bÃªtise humaine ; en ce qui  
> concerne l’univers, je n’en ai pas acquis la certitude absolue.

- Albert Einstein

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 21, 2006, 1:24pm UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/3 "2006-04-21T13:24:19Z")

</div>

Hi –

On Fri, 21 Apr 2006, Robert D. wrote:

> > > onetwo: : 00  
> > > two: 1  
> > > Hmm why don’t you drop a mail to the FAQ maintainer mailto:  
> > > removed\_email\_address@domain.invalid ?

Actually the FAQ is now maintained at Ruby Garden:  
[http://www.rubygarden.org/faq](http://www.rubygarden.org/faq). The old one, at [rubycentral.com](http://rubycentral.com),  
should connect you to the new one.

David

–  
David A. Black (removed\_email\_address@domain.invalid)  
Ruby Power and Light, LLC ([http://www.rubypowerandlight.com](http://www.rubypowerandlight.com))

“Ruby for Rails” PDF now on sale! [Ruby for Rails](http://www.manning.com/black)  
Paper version coming in early May!

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 21, 2006, 1:33pm UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/4 "2006-04-21T13:33:32Z")

</div>

On Fri, Apr 21, 2006 at 08:22:51PM +0900, removed\_email\_address@domain.invalid wrote:

> You may be looking at the old FAQ. Have a look at:
> 
> [http://www.rubygarden.org/faq/entry/show/24](http://www.rubygarden.org/faq/entry/show/24)
> 
> I think that’s the one you mean, and it looks OK.

Aha. Yes indeed.

In that case, there are two issues:

1. Googling for “ruby faq” gives the old version as the top hit.

2. I didn’t get redirected to the new version from the old version.

I’ll let Dave T. know. Thanks. 🙂

-Andy

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 21, 2006, 2:53pm UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/5 "2006-04-21T14:53:45Z")

</div>

On 4/21/06, Andy G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In that case, there are two issues:
> 
> 1. Googling for “ruby faq” gives the old version as the top hit.
> 
> 2. I didn’t get redirected to the new version from the old version.
> 
> I’ll let Dave T. know. Thanks. 🙂
> 
> -Andy

I think Hal F. is in charge of the FAQ now.

Curt

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 21, 2006, 1:24pm UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/6 "2006-04-21T13:24:23Z")

</div>

Hi –

On Fri, 21 Apr 2006, Andy G. wrote:

> > onetwo: : 11  
> > two: 3
> 
> which made more sense. OK, so thread scheduling is nondetermininistic  
> and there’s no mutual exclusion on stdout, so I can see how the output  
> given in the FAQ entry _could_ happen - however, I think the version I  
> saw demonstrates the FAQ’s point more clearly.
> 
> Who should I tell about this? Raise a bug? Or is raising the alarm  
> hereabouts sufficient? 🙂

You may be looking at the old FAQ. Have a look at:

[http://www.rubygarden.org/faq/entry/show/24](http://www.rubygarden.org/faq/entry/show/24)

I think that’s the one you mean, and it looks OK.

David

–  
David A. Black (removed\_email\_address@domain.invalid)  
Ruby Power and Light, LLC ([http://www.rubypowerandlight.com](http://www.rubypowerandlight.com))

“Ruby for Rails” PDF now on sale! [Ruby for Rails](http://www.manning.com/black)  
Paper version coming in early May!

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 23, 2006, 1:46am UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/7 "2006-04-23T01:46:04Z")

</div>

On 4/21/06, Logan C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Apr 21, 2006, at 8:53 AM, Curt H. wrote:
> 
> > I think Hal F. is in charge of the FAQ now.
> > 
> > Curt
> 
> I believe Hal F. is in charge of the newsgroup/ML faq, not the  
> ruby faq.

There’s a newsgroup/ML faq? What’s the URL?

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 23, 2006, 1:52am UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/8 "2006-04-23T01:52:14Z")

</div>

On 4/22/06, John G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> There’s a newsgroup/ML faq? What’s the URL?

Whoops. Sorry. I guess this:  
[http://rubyhacker.com/clrFAQ.html](http://rubyhacker.com/clrFAQ.html)  
is it.

---

<div class="post-metadata">

**Author:** ![nctodc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Post date:** [April 21, 2006, 4:36pm UTC](https://www.ruby-forum.com/t/threading-example-in-faq-4-2-is-slightly-broken/58410/9 "2006-04-21T16:36:19Z")

</div>

On Apr 21, 2006, at 8:53 AM, Curt H. wrote:

> I think Hal F. is in charge of the FAQ now.
> 
> Curt

I believe Hal F. is in charge of the newsgroup/ML faq, not the  
ruby faq.
