I am developing a record storage system which stores scanned, indexed and encrypted records in physical boxes.
I have a method say “getAvailablePlace()” which checks what box and what seq is available for store. I want to lock this method. Ie when one user is entered into this method and he gets box:12 seq:55 as empty place..simultaneously at same time another user is accessing same method he may also get same values..box:12 seq:55 which is error prone.
So if I can lock this method when one user is already into this process?
I am using SQLite, wamp and codeigniter.
I have this code in use:
You may alter it not to check the pid and just use the file as lock info.