I am writing an application. I came across scenario in such a way that, i have to create two threads, thread1 will be created first and thread2 will be created second. thread1 has to post in to the handler of the thread2. But as system is fast, before the time thread2 got created and handler got initialised , thread1 started posting the message objects to thread2. Due to which i am facing unexpected behaviour.
Please let me know how to wait in the thread1 for the thread2 to get started and handler is initialised. I tried polling mechanism, as it affects the system performance this fix is not getting accepted.