Is there a way to detect locked tables in MySQL? I mean tables locked by the LOCK TABLE table WRITE/READ
command.
(Note that readers interested in
You can create your own lock with GET_LOCK(lockName,timeOut)
If you do a GET_LOCK(lockName, 0)
with a 0 time out before you lock the tables and then follow that with a RELEASE_LOCK(lockName)
then all other threads performing a GET_LOCK()
will get a value of 0 which will tell them that the lock is being held by another thread.
However this won't work if you don't have all threads calling GET_LOCK()
before locking tables. The documentation for locking tables is here
Hope that helps!