rendezvous

open fun rendezvous(@Nullable handler: Handler, @NonNull runnable: Runnable)

Rendezvous on a thread.

Rendezvous is a data synchronization primitive originating from Plan 9 operating system. Two threads meet at a synchronization point to exchange a single datum.

This method uses a similar approach to temporarily “join” two threads so that the executed code appears to be running on either of them without any need for further synchronization. Internally, it runs on the handler's thread.

Parameters

handler

Handler to rendezvous on.

runnable

The runnable to run on the main thread.


open fun rendezvous(@NonNull runnable: Runnable)

Deprecated

Rendezvous with the main (UI) thread.

Rendezvous is a data synchronization primitive originating from Plan 9 operating system. Two threads meet at a synchronization point to exchange a single datum.

This method uses a similar approach to temporarily “join” two threads so that the executed code appears to be running on either of them without any need for further synchronization.

Internally, it runs on the main thread so you can call any UI method that checks the thread it is executed on.

It is similar to Activity.runOnMainThread but unlike it, this method is synchronous and waits for the runnable to finish before returning. It also passes any exception thrown by it to the calling thread instead of just ignoring it.

Parameters

runnable

The runnable to run on the main thread.