Sha256: 39c894d1ec55aa2a19b959ebc203b476caa64567f4e2bcb9e48a91d444bb2784

Contents?: true

Size: 673 Bytes

Versions: 29

Compression:

Stored size: 673 Bytes

Contents

A sequence of instructions, defined by a block, which is executed sequentially and managed by the scheduler. A task can be in one of the following states: `initialized`, `running`, `completed`, `failed`, `cancelled` or `stopped`.

```mermaid
stateDiagram-v2
[*] --> Initialized
Initialized --> Running : Run

Running --> Completed : Return Value
Running --> Failed : Exception

Completed --> [*]
Failed --> [*]

Running --> Stopped : Stop
Stopped --> [*]
Completed --> Stopped : Stop
Failed --> Stopped : Stop
Initialized --> Stopped : Stop
```

## Example

```ruby
require 'async'

# Create an asynchronous task that sleeps for 1 second:
Async do |task|
	sleep(1)
end
```

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
async-2.21.0 lib/async/task.md
async-2.20.0 lib/async/task.md
async-2.19.0 lib/async/task.md
async-2.18.0 lib/async/task.md
async-2.17.0 lib/async/task.md
async-2.16.1 lib/async/task.md
async-2.16.0 lib/async/task.md
async-2.15.3 lib/async/task.md
async-2.15.2 lib/async/task.md
async-2.15.1 lib/async/task.md
async-2.15.0 lib/async/task.md
async-2.14.2 lib/async/task.md
async-2.14.1 lib/async/task.md
async-2.14.0 lib/async/task.md
async-2.13.0 lib/async/task.md
async-2.12.1 lib/async/task.md
async-2.12.0 lib/async/task.md
async-2.11.0 lib/async/task.md
async-2.10.2 lib/async/task.md
async-2.10.1 lib/async/task.md