class Concurrent::Delay

Lazy evaluation of a block yielding an immutable result. Useful for expensive operations that may never be needed. It may be non-blocking, supports the ‘Concern::Obligation` interface, and accepts the injection of custom executor upon which to execute the block. Processing of block will be deferred until the first time `#value` is called. At that time the caller can choose to return immediately and let the block execute asynchronously, block indefinitely, or block with a timeout.

When a ‘Delay` is created its state is set to `pending`. The value and reason are both `nil`. The first time the `#value` method is called the enclosed opration will be run and the calling thread will block. Other threads attempting to call `#value` will block as well. Once the operation is complete the value will be set to the result of the operation or the reason will be set to the raised exception, as appropriate. All threads blocked on `#value` will return. Subsequent calls to `#value` will immediately return the cached value. The operation will only be run once. This means that any side effects created by the operation will only happen once as well.

‘Delay` includes the `Concurrent::Concern::Dereferenceable` mixin to support thread safety of the reference returned by `#value`.

@!macro copy_options

@!macro delay_note_regarding_blocking

@note The default behavior of `Delay` is to block indefinitely when
  calling either `value` or `wait`, executing the delayed operation on
  the current thread. This makes the `timeout` value completely
  irrelevant. To enable non-blocking behavior, use the `executor`
  constructor option. This will cause the delayed operation to be
  execute on the given executor, allowing the call to timeout.

@see Concurrent::Concern::Dereferenceable