mattn / mruby-uv

interface to libuv for mruby(experimental)
http://mattn.kaoriya.net/
92 stars 25 forks source link

Examples for UV.queue_work? #57

Closed Asmod4n closed 9 years ago

Asmod4n commented 9 years ago

couldn't get UV.queue_work to work by reading the source.

Thought it works like this:

UV.queue_work(lambda { 2 + 2 }) do |result|
  puts result
end

But its complaining about the lambda, same goes for Proc.new or proc {}.

take-cheeze commented 9 years ago

The argument of UV.queue_work can only take C function Proc since it may modify mruby resource in other thread. Use mruby-thread instead.