made surfacecreate and surfacedestroy handle the main thread