Re: Something is wrong with my threads
Marvin Gülker <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <20190417191408.qgf4z62g37z44ijm@atlantis> |
Am 17. April 2019 um 15:31 Uhr +0000 schrieb Andy Jones: > The problem is, sometimes they aren't all done. Which makes no sense > to me. Either `thread#run` sometimes doesn't wake a thread, Quote from the docs for Thread#run, emphasis mine: > Wakes up `thr', making it **eligible** for scheduling. Thread#run does not necessaryly run the thread. It only makes it eligible for scheduling. Whether or not its execution is continued, the Ruby interpreter decides. What you are doing looks like re-inventing Thread#join. Can't you just use that method? If you want a a timeout for the wait, Thread#join does take an argument (`limit') for that purpose. See the documentation for Thread#join. Marvin -- Blog: https://mg.guelker.eu Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>