[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03872] Re: Multithreaded/Embedded Ruby?

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-06 14:04:48 UTC
List: ruby-talk #3872
> So in this case, nobody has answered my question: Is the Ruby 
> interpreter thread safe 

No it's not as an interpreter, a program. You can't make multithreaded C
program calling the interpreter to execute programs simultaneously. Or you
can, but you have to setup thread-safety features by yourself.

But however it's thread-safe as a executor of Ruby code. There can be
multiple threads of Ruby code running simultaneously on one single
interpreter.

Even then, you have to arrange mutexes for the data etc. There're few
stadard libraries for that.

In any case we have to define what we're talking about with thread-safety.
Is it the fact that the code will run most of the time concurrently without
messing up data or getting into death-lock? Or is about re-entrantness?

Inside Ruby re-entrantness is not guaranteed, but most of the time things
work. They don't work particularly when the method call assings the result
on a global variable and you rely on that. But the same thing applies to all
languages -- while some languages might have designed their libraries quite
well, so there's none or almost at all side effects. (Ruby is close to that
and methods making side effects are documented and do that only for
convenience of non-concurrent programmers.)

	- Aleksi


In This Thread

Prev Next