27.06.2011, 07:44
Quote:
well we can't do much about the choice of the sa-mp devs, they've chosen pawn as the scripting lang and you can't do much about it so I think we have to improve it on our own, and multi architecture is a big improvement if we get it to work because nowadays gamemodes ARE NOT 'light'! many code is processed each second , and in most scenarios the code can be processed safely in threads (like updating player textdraw information, instead of looping throu all players and then go on with our gamemode!).
But can anyone give me some examples? and does this really improve the speed ? :P my question still remains: how the heck can you run a callback in a separate thread ? :O |
Example: You want to sort an array by using mergesort. You can sort the two halfs by two threads and merge it afterwards. In the best case, you will use only half of the time compared to the time it takes when using only one thread.
But do you actually know what it takes to make a save multithreaded program? Have you got any clue of parallel programming?
You can't use multiple threads in PAWN since PAWN has absolutely no support for multithreading.
You may need real locks to lock a variable or you may need volatile variables to prevent race conditions. However, locking a variable can introduce deadlocks and your whole server would freeze until someone shuts it down.
There are many other things you have to know about to make a thread-save program/script.
Noone here is able to make a multithreaded script using this plugin since noone has the necessary utils.
Example: Look at the object streamer. It may look save, but what happens when an object has to be destroyed and in the same moment its being streamed for a player. The object may be created after it has been destroyed and suddenly there's an object which can't be destroyed because the streamer actually doesn't know that it's there.
When this happens 400 times, the whole streamer may fuck up for a player.