Detecting file lock and waiting
Posted: Fri Oct 23, 2015 5:06 am
Hi, how can I detect if a file is locked and wait until it is unlocked? I have a plug-in that begins the process of unlocking but right now it only works if I naively sleep for about a second. (I'm trying to avoid the restart in uninstall.)
In testing, a second is enough time for the lock to release, but 250 ms is too little. However, maybe this will vary depending on the machine. Ideally I would like to wait up to 4-5 seconds but check every 500 ms or so.
In testing, a second is enough time for the lock to release, but 250 ms is too little. However, maybe this will vary depending on the machine. Ideally I would like to wait up to 4-5 seconds but check every 500 ms or so.