[#6363] Re: rescue clause affecting IO loop behavior — ts <decoux@...>

>>>>> "D" == David Alan Black <dblack@candle.superlink.net> writes:

17 messages 2000/11/14
[#6367] Re: rescue clause affecting IO loop behavior — David Alan Black <dblack@...> 2000/11/14

Hello again --

[#6582] best way to interleaf arrays? — David Alan Black <dblack@...>

Hello --

15 messages 2000/11/26

[#6646] RE: Array Intersect (&) question — Aleksi Niemel<aleksi.niemela@...>

Ross asked something about widely known and largely ignored language (on

23 messages 2000/11/29
[#6652] RE: Array Intersect (&) question — rpmohn@... (Ross Mohn) 2000/11/29

aleksi.niemela@cinnober.com (Aleksi Niemel) wrote in

[#6723] Re: Array Intersect (&) question — Mathieu Bouchard <matju@...> 2000/12/01

> >Use a hash. Here's code to do both and more. It assumes that

[#6656] printing/accessing arrays and hashes — raja@... (Raja S.)

I'm coming to Ruby with a Python & Common Lisp background.

24 messages 2000/11/30

[ruby-talk:6395] Re: lots of Threads

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-11-16 14:10:56 UTC
List: ruby-talk #6395
On Thu, 16 Nov 2000, hipster wrote:

> Maybe the async producer/consumer example in
> http:/www.xs4all.nl/~hipster/lib/ruby/semaphore is of any use? If you

Yes, that looks good.  It is pretty clear what is going on [and it is
some years since I learned about semaphores! :-)]

Is the following patch necessary, do you think?

neelix hgs 129 %> gdiff -u semaphore.orig semaphore
--- semaphore.orig      Thu Nov 16 13:59:00 2000
+++ semaphore   Thu Nov 16 14:03:03 2000
@@ -60,7 +60,7 @@
                @sem = Semaphore.new 3                  # 3 resources
available
 
                for i in 0..9 do
-                       threads.push Thread.start{ client i }
+                       threads.push Thread.start(i){ |i1| client i1 }
                end
 
                threads.each{ |t| t.join }
neelix hgs 130 %> 

This is on the basis of Programming Ruby page 114, i.e, that the variable
i might change "under the nose of" the call to client.   I suppose it
depends on granularity, and may be a very paranoid approach...

> elect to fork the processes the Semaphore class would have to use IPC
> primitives, of course.
> 
> 	Michel
> 
	Hugh
	hgs@dmu.ac.uk


In This Thread