tags:

views:

22

answers:

2

I have a MySQL ISAM table being accessed my multiple php instances. Right now I'm using a WRITE lock to serialize access to this table.

My question is how do I ensure that the PHP instances get served on a First-Come-First-Serve basis? Or is this the default behaviour?

The official MySQL documentation doesn't mention anything about the blocked thread order for threads of the same lock type (ie multiple threads attempting a WRITE LOCK). It only mentions that a WRITER will jump to the front of the waiting queue if READERS are waiting.

A: 

All lock requests are put in a lock queue. That way your write locks will be handled in the same order as they were received by the mysql server.

This is default behaviour.

You only have to make sure your requests are made in the wanted order.

favo
+1  A: 

If the docs call it a "queue", that tends to mean "first come, first served".

cHao
Thanks, I gave you an upvote.
teehoo