Skip to content

Commit

Permalink
More README
Browse files Browse the repository at this point in the history
  • Loading branch information
noteflakes committed Nov 11, 2024
1 parent 1ce865e commit 629b5dd
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,26 @@ loop do
end
end
```

## Concurrent Execution

Concurrent execution is done by calling `#spin`, which creates a fiber:

```ruby
machine = UringMachine.new

rfd, wfd = machine.pipe

f1 = machine.spin do
machine.write(wfd, 'hello')
machine.write(wfd, 'world')
machine.close(wfd)
end

bgid = machine.setup_buffer_ring(4096, 1024)
f2 = machine.spin do
machine.read_each(rfd, bgid) do |str|
puts str
end
end
```

0 comments on commit 629b5dd

Please sign in to comment.