In your last example, if you don’t link in threads.cmxa it seems to work OK. I’ve not tested your other one.
threads.cmxa