07-01-2015, 03:22 AM
Ok now I c. how it works and what you can and can't do using the current API. In my opinion you should add additional classes to the server API (and do not touch underlying logic!) that are used for threading. The plugins don't need to be multi-thread in the basic mode but if someone wants to use multi-threading allow it! If something fails its his/hers problem.
What classes I would add:
cLock --> simple mutex. It allows read write synchronization point
cReaderWritterLock -> a more complex mutex that allows single writer access or multiple readers
cSemaphore -> a multi thread barrier that allows X clients to enter into the critical section
cThreadPool -> a class that allows you to run a method in a new thread,
The bare minimum: cLock and a method to allow to tun a method on a new thread.
If you do not have any threading you will be able to implement the async mode to WorldEdit similar to first release of AsyncWorldEdit. The world editing is done in chunks (stage 2) and the blocks preparation (stage 1) is done on the main thread. This is ok for 75% of all situations, but its not enough for extremely large edits. Don't get me wrong because you are using C++ as the base it will work for much larger edits then in Bukkit/Spigot.
What classes I would add:
cLock --> simple mutex. It allows read write synchronization point
cReaderWritterLock -> a more complex mutex that allows single writer access or multiple readers
cSemaphore -> a multi thread barrier that allows X clients to enter into the critical section
cThreadPool -> a class that allows you to run a method in a new thread,
The bare minimum: cLock and a method to allow to tun a method on a new thread.
If you do not have any threading you will be able to implement the async mode to WorldEdit similar to first release of AsyncWorldEdit. The world editing is done in chunks (stage 2) and the blocks preparation (stage 1) is done on the main thread. This is ok for 75% of all situations, but its not enough for extremely large edits. Don't get me wrong because you are using C++ as the base it will work for much larger edits then in Bukkit/Spigot.