potential bug fix: ensure that function called in the mainloop won't block

darcs-hash:20081126171844-b2873-b9c13d1825ff170e04466757c0db4f3055c2d4d0