From: Daniel Bretoi Date: 2003-02-01T08:39:24+09:00 Subject: Re: removing a dead thread does this seem reasonable? while threads.size > ARGV[0].to_i threads.each { |aThread| threads.delete(aThread) unless aThread.alive? } end On Fri, Jan 31, 2003 at 06:59:05PM -0500, Daniel Bretoi wrote: > Scenario: I have a set of 20 things to do. I can only do 4 things at a > time. > > How can I limit myself to 4 threads? > > This is what I have: > > threads = [] > designs.each { |d| > while threads.size > ARGV[0].to_i > do something? > end > threads << Thread.new(d) { |t| > do stuff... > } > } > > > how would I remove a thread once it's done? > > ideas? > > db > > -- > Jan 31 Jackie Robinson born, 1919 > Jan 31 Hewlett-Packard founded, 1939 > Jan 31 "Ham" the chimpanzee soars into space aboard Mercury-Redstone 2, 1961 > Jan 31 Explorer I launched, 1958. Van Allen Belt discovered > Jan 31 Irving Langmuir, 1881, invented tungsten filament lamp > Feb 1 First TV soap: Secret Storm, 1954 > Feb 1 Forces led by Khomeini take over Iran, 1979 > Feb 1 Chinese New Year Holiday (3 days) in Taiwan > Feb 2 Candlemas > Jan 31 The Grateful Dead are busted in New Orleans, 1970 > Feb 1 RCA Victor unveils the 45 rpm record playing system, 1949 > Feb 2 Graham Nash is born in Lancashire, England, 1942 > Feb 2 Groundhog Day > Feb 2* Parashat Yitro -- Jan 31 Jackie Robinson born, 1919 Jan 31 Hewlett-Packard founded, 1939 Jan 31 "Ham" the chimpanzee soars into space aboard Mercury-Redstone 2, 1961 Jan 31 Explorer I launched, 1958. Van Allen Belt discovered Jan 31 Irving Langmuir, 1881, invented tungsten filament lamp Feb 1 First TV soap: Secret Storm, 1954 Feb 1 Forces led by Khomeini take over Iran, 1979 Feb 1 Chinese New Year Holiday (3 days) in Taiwan Feb 2 Candlemas Jan 31 The Grateful Dead are busted in New Orleans, 1970 Feb 1 RCA Victor unveils the 45 rpm record playing system, 1949 Feb 2 Graham Nash is born in Lancashire, England, 1942 Feb 2 Groundhog Day Feb 2* Parashat Yitro