Skip to content

Commit

Permalink
docs: remove private module usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarriga committed Feb 19, 2024
1 parent 5a3a06e commit 17f57bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ Primitives for flow control in async functions
```lua
local event = nio.control.event()

local worker = nio.tasks.run(function()
local worker = nio.run(function()
nio.sleep(1000)
event.set()
end)

local listeners = {
nio.tasks.run(function()
nio.run(function()
event.wait()
print("First listener notified")
end),
nio.tasks.run(function()
nio.run(function()
event.wait()
print("Second listener notified")
end),
Expand Down
8 changes: 4 additions & 4 deletions doc/nio.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ The event can be set from a non-async context.
>lua
local event = nio.control.event()

local worker = nio.tasks.run(function()
local worker = nio.run(function()
nio.sleep(1000)
event.set()
end)

local listeners = {
nio.tasks.run(function()
nio.run(function()
event.wait()
print("First listener notified")
end),
nio.tasks.run(function()
nio.run(function()
event.wait()
print("Second listener notified")
end),
Expand Down Expand Up @@ -230,7 +230,7 @@ Create a new FIFO queue with async support.
>lua
local queue = nio.control.queue()

local producer = nio.tasks.run(function()
local producer = nio.run(function()
for i = 1, 10 do
nio.sleep(100)
queue.put(i)
Expand Down
8 changes: 4 additions & 4 deletions lua/nio/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ nio.control = {}
--- ```lua
--- local event = nio.control.event()
---
--- local worker = nio.tasks.run(function()
--- local worker = nio.run(function()
--- nio.sleep(1000)
--- event.set()
--- end)
---
--- local listeners = {
--- nio.tasks.run(function()
--- nio.run(function()
--- event.wait()
--- print("First listener notified")
--- end),
--- nio.tasks.run(function()
--- nio.run(function()
--- event.wait()
--- print("Second listener notified")
--- end),
Expand Down Expand Up @@ -160,7 +160,7 @@ end
--- ```lua
--- local queue = nio.control.queue()
---
--- local producer = nio.tasks.run(function()
--- local producer = nio.run(function()
--- for i = 1, 10 do
--- nio.sleep(100)
--- queue.put(i)
Expand Down

0 comments on commit 17f57bc

Please sign in to comment.