Is it OK not to call Thread#join? In this case, I don’t care if the thread blows up – I just want Unicorn to keep processing.
class MyMiddleware
def initialize(app)
@app = app
end
def call(env)
t = Thread.new { sleep 1 }
t.join # is it ok if I skip this?
@app.call env
end
end
Will I get “zombie threads” or something like that?
It’s perfectly fine to not call
join– in fact,joinis often not needed at all with multithreaded code. You should only calljoinif you need to block until the new thread completes.You won’t get a “zombie” thread. The new thread will run until completion, then clean itself up for you.