parkUntil

suspend fun parkUntil(blocker: Any?, deadline: Instant)

Disables the current thread for thread scheduling purposes, until the specified deadline, unless the permit is available.

If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:

  • Some other thread invokes .unpark with the current thread as the target; or

  • Some other thread interrupts the current thread; or

  • The specified deadline passes; or

  • The call spuriously (that is, for no reason) returns.

This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the current time upon return.

Since

1.6

Parameters

blocker

the synchronization object responsible for this thread parking

deadline

the absolute time, in milliseconds from the Epoch, to wait until


suspend fun parkUntil(deadline: Instant)

Disables the current thread for thread scheduling purposes, until the specified deadline, unless the permit is available.

If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:

  • Some other thread invokes .unpark with the current thread as the target; or

  • Some other thread interrupts the current thread; or

  • The specified deadline passes; or

  • The call spuriously (that is, for no reason) returns.

This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the current time upon return.

Parameters

deadline

the absolute time, in milliseconds from the Epoch, to wait until