A safe API for interacting with the world from web threads
#1
Web plugins do not currently have a safe way of calling the world from web threads. I propose a new API, cWorld:DoWithWorld, that allows a web thread to call functions that access the world.

Like the rest of the DoWithXYZ functions it would take a function of what to do with the world. When called DoWithWorld would try and gain the world lock with a short timeout. If this timeout where to fail, then the binding uses lua co-routines to yield control back out to the web-admin bindings. The web-admin bindings would then release the plugin lock, yield the OS thread, then regain the plugin lock, and resume back into DoWithWorld. This allows the thread holding the World lock to gain the plugin lock, without risking safety.

This would have to be documented as potentially calling back into the plugin before calling the callback, but would be safe from deadlocks. Does anyone think this would be worth blocking the use of coroutines in lua for?
Reply
Thanks given by:


Messages In This Thread
A safe API for interacting with the world from web threads - by worktycho - 05-02-2015, 03:32 AM



Users browsing this thread: 1 Guest(s)