Sunday 15 January 2017

Difference in yield and join ?

Difference in yield and join

yield() method pauses the currently executing thread temporarily for giving a chance to the remaining waiting threads of the same priority to execute. If there is no waiting thread or all the waiting threads have a lower priority then the same thread will continue its execution.

join() If any executing thread t1 calls join() on t2 i.e.; t2.join() immediately t1 will enter into waiting state until t2 completes its execution.

No comments:

Post a Comment