Class List Method List File List

# Class: Concurrent::Promises::ResolvableEvent

Inherits:
  Event
  - Object
  - Synchronization::Object
  - AbstractEventFuture
  - Event
  - Concurrent::Promises::ResolvableEvent
  show all
Includes:
  Resolvable
Defined in:
  lib/concurrent/edge/promises.rb

## Overview

A Event which can be resolved by user.

## Constant Summary

## Instance Method Summary (collapse)

- - (self, false) resolve(raise_on_reassign = true)

  Makes the event resolved, which triggers all dependent futures.

- - (Event) with_hidden_resolvable

  Creates new event wrapping receiver, effectively hiding the resolve method.

## Instance Method Details

### - (`self`, `false`) resolve(raise_on_reassign = true)

Makes the event resolved, which triggers all dependent futures.

Parameters:

- raise_on_reassign (`Boolean`) (defaults to: `true`) —

  should method raise exception if already resolved

Returns:

- (`self`, `false`) —

  false is returner when raise_on_reassign is false and the receiver is already resolved.

    1255
    1256
    1257

    # File 'lib/concurrent/edge/promises.rb', line 1255

    def resolve(raise_on_reassign = true)
      resolve_with RESOLVED, raise_on_reassign
    end

### - (`Event`) with_hidden_resolvable

Creates new event wrapping receiver, effectively hiding the resolve method.

Returns:

- (`Event`)

    1262
    1263
    1264

    # File 'lib/concurrent/edge/promises.rb', line 1262

    def with_hidden_resolvable
      @with_hidden_resolvable ||= EventWrapperPromise.new_blocked_by1(self, @DefaultExecutor).event
    end