Threads (PAWN, MySQL thread and Timers)
#1

Hello
I write this post since I have a doubt about the threaded queries behavior. I don't know if when they are executed and call the specified function, they use another thread for the execution or they use the main PAWN thread. I have the same doubt for SetTimer and SetTimerEx and their behaviors.
Let me explain it with an example:
Код:
mysql_tquery(connectionID, query, "saveAKA", "ss", Player[playerid][pName], ip);
forward saveAKA(playerName[], ip[]);
public saveAKA(playerName[], ip[])
{
//Some code here
}
//Below, a random function, with the use of normal and safe queries (non-threaded)
mysql_format(connectionID, query, sizeof(query),"SELECT Password FROM Users WHERE PlayerName='%e'", Player[playerid][pName]);
	result = mysql_query(connectionID, query);
//... more code
But what happens then if the threaded query finishes its execution in the exact moment the normal query finishes its execution, then there will be a problem with the active cache, so the active cache could be of the thread query or the normal query.
The same applies to Timers and the value of variables of the timer-function itself that are used in another functions.
How to avoid it?
I have already read this: http://forum.sa-mp.com/showpost.php?...postcount=2141
I hope anyone can clarify these doubts
Thanks in advance
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)