Edge Drivers: safe way to use coroutine methods?

Hello - I’ve got a Lua library I’m trying to make work in the Edge environment. It has its own ‘ioloop’ (run forever) and uses coroutine methods (create/yield/resume). I’ve attempted to execute this code in a cosock.spawn thread, but am having issues.

Is there a safe way to utilize coroutine methods in an Edge driver, or would this cause problems? Ideally, I’d like a way to convert the existing library code without having to do major re-writes. Besides cosock.spawn(), are there cosock-equivalent methods an Edge driver can use to implement/control coroutines with yield and resume?

EDIT: I should add the following info: This library is doing socket receives in its ioloop; I have modified the code to use cosock. However the following error is occurring:

[string “cosock/socket/internals.lua”]:67: thread resumed without awaited socket or error (or too many sockets)

I suspect the answer is probably that this is a big no-no - that a channel handler or cosock.spawn or Thread should be used rather than the standard coroutine methods. However, because I’m running this code within a cosock.spawn thread, I thought it might work…

Hi, Todd!

I already shared your case with the engineering team. Once I get their feedback I’ll let you know :smiley:

1 Like

Following up on this topic. The team mentioned only cosock is supported, so external libraries might not work as expected.