public static bool FoxTableLock(this AdsExtendedReader rdr, string table) { var isLocked = false; for (var i = 0; i < 100; i++) { try { rdr.LockTable(); isLocked = rdr.IsTableLocked(); if (isLocked) { break; } } catch (Exception e) { Debug.WriteLine($"waiting for flock {rdr.RecordNumber}"); System.Threading.Thread.Sleep(500); } } if (!isLocked) { Debug.WriteLine($"Unable to flock {table}"); } return(isLocked); }