document service: only wait for the thread when it exists

(integrated from trunk branch change 7611d03 by Todd Whiteman <toddw@activestate.com>)