File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 11local channel = require ' bee.channel'
22local select = require ' bee.select'
3+ local thread = require ' bee.thread'
34
45local function channel_init (chan )
56 local selector = select .create ()
910
1011local function channel_bpop (ctx )
1112 local selector , chan = ctx [1 ], ctx [2 ]
12- for _ in selector :wait () do
13- local r = table.pack (chan :pop ())
14- if r [1 ] == true then
15- return table.unpack (r , 2 )
13+ while true do
14+ for _ in selector :wait () do
15+ local r = table.pack (chan :pop ())
16+ if r [1 ] == true then
17+ return table.unpack (r , 2 )
18+ end
1619 end
20+ thread .sleep (10 )
1721 end
1822end
1923
Original file line number Diff line number Diff line change 33--- @class bee.thread
44local thread = {}
55
6- --- @param time number
6+ --- @param time integer
77function thread .sleep (time ) end
88
99--- @param name string
@@ -15,7 +15,10 @@ function thread.channel(name) end
1515
1616--- @param script string
1717--- @return bee.thread.thread
18- function thread .thread (script ) end
18+ function thread .create (script ) end
19+
20+ --- @return string ?
21+ function thread .errlog () end
1922
2023--- @class bee.thread.channel
2124local channel = {}
You can’t perform that action at this time.
0 commit comments