I've three threads. T1 is main thread and T2 is the child thread. I've to perform a task on Thread T2 in both Synchronous as well as Asynchronous manner by using an explicit call from Thread T1. For Async call, I'm using my code as below.
The above code snippet is working good. But for Synchronous call, I need to initiate the child thread T2 from main thread T1 and I should execute it asynchronusly without affecting T1 performance and join the response to parent thread T1. Currently I'm using the code snippet as like below.
The problem here is, when doWork() is being called, T1 is continuing with its execution, without being waited for T2 to finish of its execution. I can allow only 200ms for T2 to execute, means I can allow T1 to wait for only 200ms. If T2 exceeds this time, T1 is not getting the update from T2. How can I achieve this???
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad: