Introduction: This is the PHP synchronization scheme detailed page, introduced and php,php PHP synchronization program related knowledge, skills, experience, and some PHP source code and so on.
class= ' pingjiaf ' frameborder= ' 0 ' src= ' http://biancheng.dnbcw.info/pingjia.php?id=356624 ' scrolling= ' no ' > PHP synchronous execution is quite troublesome, according to the MySQL documentation, so to do.
===============================================================
Get_lock (Str,timeout)
Try to use string str given the name to get a lock, timeout to timeout seconds. If the lock is successfully obtained, 1 is returned, and if the operation times out it returns 0 (for example, because another client has blocked the name earlier), or null if an error occurs (such as a lack of memory or thread mysqladmin Kill is disconnected). If you have a lock that you get with Get_lock (), the lock will be lifted when you perform release_lock () or your connection is disconnected (normal or abnormal).
This function can be used to perform an application lock or an impersonation record lock. The name is locked within the server scope. If a name has been blocked by a client, Get_lock () will block any request from another client for blocking the same name. This allows the client to agree on a blockade name to use this name to work with the proposed lock. Be aware, however, that it also allows a client that is not in a group of cooperating clients to block the name, whether it is in service or unintentional, which prevents any client in cooperation from blocking the name. One way to reduce this situation is to use database-specific or application-specific block names. For example, use a block name in the form of db_name.str or APP_NAME.STR.
===============================================================
If a file does not want to be accessed concurrently by the user, it can only be accessed sequentially.
If a. PHP This file, do not want to be accessed at the same time by two requests, you can:
$db = Getdb ();//Get a database connection.
$db->query (' do Get_locak ');
Love EE focus on Java Michael Jackson Video station JSON online tool
Http://biancheng.dnbcw.info/php/356624.html Pageno:2