make the threading a bit more robust: if c_wait... is called before the thread is spawned,

on some machines resulted in a segfault. Now this should be safe