It depends on how your API works, what it is supposed to do and what it is supposed to communicate to the UI. In general data exchange between threads requires synchronization using semaphores or similar mechanisms.