make iomux_run and set_error  reentrant by not using static and globals variables