Ease thread execution
#1

Well, I was preparing myself for writing a quite simple speedometer for my RPG Gamemode and something came up on my mind while designing the layout of data checking->assigning.
I thought about checking, time by time, a static type variable of a timestamp from last speed check and, then, if some considerable amount of time has passed since last check, call a 1 millisecond timer for a checking function for each player.

As you must know, Pawn is single-threaded and, the amount of code you write in some public function is equivalent to the time the whole gamemode/filterscript thread will 'freeze', executing it. That means if some player types a /command during loading one thousand houses from a MySQL database, it will take a while to the server to process the command.

With this layout, we can create some 'subthreads' as the process described up there is very similar to the way windows (as an example) simulates multithreading on single-cored processors (as I'm not sure how this works on multi-cored processors).

I believe this isn't a bad choice, but I'd like to hear your opinion about this layout.
I have seen some similar code on here, but if this is a topic already discussed, my apologies.
And sorry for my bad English.
Reply


Messages In This Thread
Ease thread execution - by Stewie` - 21.12.2012, 12:37
Re: Ease thread execution - by Y_Less - 21.12.2012, 14:46
Re: Ease thread execution - by Stewie` - 21.12.2012, 15:12
Re: Ease thread execution - by Y_Less - 21.12.2012, 15:18
Re: Ease thread execution - by Stewie` - 21.12.2012, 15:30
Re: Ease thread execution - by Y_Less - 21.12.2012, 15:58
Re: Ease thread execution - by Babul - 22.12.2012, 21:08
Re: Ease thread execution - by Y_Less - 22.12.2012, 22:12
Re: Ease thread execution - by BlueX - 26.12.2012, 21:46
Re: Ease thread execution - by Stewie` - 26.12.2012, 22:32
Re: Ease thread execution - by [HLF]Southclaw - 30.12.2012, 18:22

Forum Jump:


Users browsing this thread: 1 Guest(s)