Files
news.gitea.happylizard.me/bin/gems/async-2.23.0/lib/async/task.md
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

31 lines
673 B
Markdown

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
```