PHP Synchronization Scheme
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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.