Propagating events
#5
Lua itself is synchronous, but the server around it is not. Before any Lua code is executed, a plugin-specific mutex is acquired. All the API calls that the plugin makes are then executed with that mutex locked. This is the core of the problem - one thread acquires this mutex and calls the Remove API, and in between those two, the world tick thread tries to call the hook. The world tick thread is waiting to acquire the mutex, while the first thread is busy removing the hook. This is the situation that needs to be taken extreme care of.

If you're willing to put some effort into coding the server, may I recommend picking a different task? There are quite a few plugin requests, some of them really relevant and useful, such as the Grief Prevention plugin ( https://forum.cuberite.org/showthread.php?tid=1671 ). Or if you want to code something in C++ instead, how about fixing the crash that occurs when a task is scheduled by a plugin and the plugin is unloaded before the task runs ( https://github.com/mc-server/MCServer/issues/1556 ). These would be, in my personally biased opinion, much more useful Smile
Reply
Thanks given by: Seadragon91


Messages In This Thread
Propagating events - by seiji - 01-26-2015, 02:50 AM
RE: Propagating events - by xoft - 01-26-2015, 03:22 AM
RE: Propagating events - by seiji - 01-26-2015, 04:22 AM
RE: Propagating events - by worktycho - 01-26-2015, 04:39 AM
RE: Propagating events - by xoft - 01-26-2015, 05:03 AM



Users browsing this thread: 2 Guest(s)