The PCem compatibility layer returned a raw uae_thread_id as a
thread_t pointer and then waited on that value through the semaphore
API. That was pointer-shaped on some targets, but it was not a valid
wrapper around UAE's thread API.
Store the uae_thread_id in an explicit PCem handle object, join it
with uae_wait_thread(), and free the wrapper after wait or close. Reset
and signal PCem events through the existing semaphore object instead of
passing the address of a local pointer copy.