Change thread prototype to allow setting error handler

Change thread prototype to allow setting error handler (wolfmitchell)