From: Tony Arcieri Date: 2012-07-06T01:34:13+09:00 Subject: Re: Green threads in 1.9.* ? --00151761c7aa993ea504c417b77e Content-Type: text/plain; charset=ISO-8859-1 On Thu, Jul 5, 2012 at 6:38 AM, rex goxman wrote: > This is a crappy example, but say you need to do some > calculation which might fail or even crash, but you don't want (or need) > to check the inputs to the calculation, or wrap the thing up in an error > catching mechanism, or anything of this nature. You just want to > calculate it, and if it works, fine, and if it doesn't (or even crashes) > - fine, your main program continues to run. So spawn a green thread to > run the calculation. If it works, great. If it crashes, who cares? > You want threads as a way to silently swallow exceptions? o_O I'm going to go out on a limb and say that's a terrible application for threads... You might say "do that with a kernel thread." But what if I want to > spawn this thread over and over again in a tight loop? I don't want or > need the monstrous overhead of a kernel thread here. I just want a > green thread. > If the time it takes to spawn a thread is really too much, use a thread pool. -- Tony Arcieri --00151761c7aa993ea504c417b77e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Thu, Jul 5, 2012 at 6:38 AM, rex goxman <= lists@ruby-forum.com> wrote:
This is a crappy example, but say you need to do some calculation which might fail or even crash, but you don't want (or need= )
to check the inputs to the calculation, or wrap the thing up in an error catching mechanism, or anything of this nature. =A0You just want to
calculate it, and if it works, fine, and if it doesn't (or even crashes= )
- fine, your main program continues to run. =A0So spawn a green thread to run the calculation. =A0If it works, great. =A0If it crashes, who cares?

You want threads as a way to silently swa= llow exceptions? o_O I'm going to go out on a limb and say that's a= terrible application for threads...

You might say "do that with a kernel thread." =A0But what if I wa= nt to
spawn this thread over and over again in a tight loop? =A0I don't want = or
need the monstrous overhead of a kernel thread here. =A0I just want a
green thread.

If the time it takes to s= pawn a thread is really too much, use a thread pool.

--
Tony Arcieri

--00151761c7aa993ea504c417b77e--