Asynchronous tasks
#23
I think the threading model could probably look best like this:
Main thread collects all needed information -> Creates new thread to process it -> Calls a function in the main thread to do something with the processed information.

In WorldEdit it could look like this:
User uses "//set stone,dirt" ->
The selected area is read into a cBlockArea ->
A new thread is created with a function that fills the cBlockArea with stone and dirt ->
The thread calls a function in the main thread with the cBlockArea as a parameter ->
The main thread writes the cBlockArea back in the world.

The only thing that could block the server with this is the reading and writing of the cBlockArea, but I doubt that could be fixed easily.


Long story short, perhaps threads created by a plugin shouldn't interact with worlds, entities, players etc. Just process information that was collected before in the main thread.

If we'd expect the plugin developers to program threads like this would there still be a problem with the ForEachXYZ calls?
Reply
Thanks given by:


Messages In This Thread
Asynchronous tasks - by Howaner - 03-11-2015, 05:58 AM
RE: Asynchronous tasks - by NiLSPACE - 03-11-2015, 06:12 AM
RE: Asynchronous tasks - by worktycho - 03-11-2015, 06:16 AM
RE: Asynchronous tasks - by NiLSPACE - 04-12-2015, 12:39 AM
RE: Asynchronous tasks - by xoft - 04-12-2015, 01:31 AM
RE: Asynchronous tasks - by NiLSPACE - 04-12-2015, 09:54 PM
RE: Asynchronous tasks - by xoft - 04-13-2015, 12:50 AM
RE: Asynchronous tasks - by xoft - 04-13-2015, 12:54 AM
RE: Asynchronous tasks - by NiLSPACE - 04-13-2015, 01:29 AM
RE: Asynchronous tasks - by worktycho - 04-15-2015, 09:49 AM
RE: Asynchronous tasks - by NiLSPACE - 04-15-2015, 05:46 PM
RE: Asynchronous tasks - by worktycho - 04-15-2015, 07:45 PM
RE: Asynchronous tasks - by xoft - 04-15-2015, 08:06 PM
RE: Asynchronous tasks - by worktycho - 04-15-2015, 08:24 PM
RE: Asynchronous tasks - by NiLSPACE - 04-15-2015, 08:26 PM
RE: Asynchronous tasks - by worktycho - 04-15-2015, 08:34 PM
RE: Asynchronous tasks - by NiLSPACE - 04-15-2015, 09:13 PM
RE: Asynchronous tasks - by worktycho - 04-15-2015, 09:16 PM
RE: Asynchronous tasks - by NiLSPACE - 04-15-2015, 09:24 PM
RE: Asynchronous tasks - by worktycho - 04-15-2015, 09:36 PM
RE: Asynchronous tasks - by xoft - 04-15-2015, 09:48 PM
RE: Asynchronous tasks - by worktycho - 04-15-2015, 09:59 PM
RE: Asynchronous tasks - by NiLSPACE - 09-28-2015, 08:10 PM
RE: Asynchronous tasks - by xoft - 09-28-2015, 09:53 PM
RE: Asynchronous tasks - by NiLSPACE - 09-28-2015, 10:00 PM
RE: Asynchronous tasks - by worktycho - 09-28-2015, 10:09 PM



Users browsing this thread: 8 Guest(s)