Changeset 840 for trunk/server/lib/tdb/common/io.c
- Timestamp:
- Feb 4, 2014, 4:58:40 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/lib/tdb/common/io.c
r835 r840 92 92 93 93 #ifdef __OS2__ 94 // YD we must upgrade read locks to write locks (exclusive), otherwise94 // YD we must upgrade read locks to write locks (exclusive), as otherwise 95 95 // the owner (us) is not allowed to write to the file (different from unix) 96 96 // if a wider previous lock is in effect, we cannot write lock our segment 97 97 // (e.g. a lock_upgrade locks all the file), so we hope the previous lock 98 98 // is a write lock: do not wait for lock. 99 int upgradeLockRC = tdb_brlock( tdb, F_WRLCK, off, len, F_SETLK); 99 // so this is what we try here: 100 // 1. add a write lock and see if it works 101 // 2. if the write lock wasn't set, we try to unlock the segment 102 // first and add the write lock afterwards 103 int upgradeLockRC = tdb_brlock(tdb, F_WRLCK, off, len, TDB_LOCK_NOWAIT); 104 if (upgradeLockRC != 0) { 105 tdb_brunlock(tdb, F_RDLCK, off, len); 106 int upgradeLockRC = tdb_brlock(tdb, F_WRLCK, off, len, TDB_LOCK_NOWAIT); 107 } 100 108 TDB_LOG((tdb, TDB_DEBUG_TRACE,"upgrading lock at %d len=%d " 101 109 "before writing %s (rc=%d).\n", off, len,
Note:
See TracChangeset
for help on using the changeset viewer.