Actually import errno so it can be used.
Update threading helper function.