it's just an idea... 
maybe a user function could solve your problem, get_lock don't work with tables, it just use mysql server memory
i think it's not 'crash fail', if you kill the mysql process all 'locks' are released
and i think it use mutex and locks to only execute 1 lock for each 'str' variable, must check the source code


2013/5/15 Gordan Bobic <gordan@bobich.net>
On 05/15/2013 09:24 PM, Roberto Spadim wrote:
hum, maybe a 'global variable' + a 'counter' function could do the job?

select add_and_return(@global_var,1)
could return old global_var value +1, and set the global_var to +1

just a idea.. like GET_LOCK(str,timeout) do, but without timeout

How would the function avoid the race condition?
Is it actually possible to have user-defined global variables?

Gordan




--
Roberto Spadim
SPAEmpresarial