Changeset 456 for trunk/server/lib/tdb/common/io.c
- Timestamp:
- Jun 7, 2010, 9:08:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/lib/tdb/common/io.c
r414 r456 90 90 return -1; 91 91 92 #ifdef __OS2__ 93 // YD we must upgrade read locks to write locks (exclusive), otherwise 94 // the owner (us) is not allowed to write to the file (different from unix) 95 TDB_LOG((tdb, TDB_DEBUG_TRACE,"unlocking at %d len=%d before writing.\n", off, len)); 96 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, 1); 97 // if a wider previous lock is in effect, we cannot write lock our segment 98 // (e.g. a lock_upgrade locks all the file), so we hope the previous lock 99 // is a write lock: do not wait for lock. 100 tdb_brlock( tdb, off, F_WRLCK, F_SETLK, 0, len); 101 #endif 102 92 103 if (tdb->map_ptr) { 93 104 memcpy(off + (char *)tdb->map_ptr, buf, len); … … 115 126 "write %d bytes at %d in two attempts\n", 116 127 len, off)); 117 return -1; 118 } 119 } 128 129 #ifdef __OS2__ // remove our lock 130 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len); 131 #endif 132 return -1; 133 } 134 } 135 136 #ifdef __OS2__ // remove our lock 137 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len); 138 #endif 139 120 140 return 0; 121 141 }
Note:
See TracChangeset
for help on using the changeset viewer.