Changeset 41


Ignore:
Timestamp:
Jun 18, 2007, 1:08:20 PM (13 years ago)
Author:
Yuri Dario
Message:

Do not use exclusive locks always, try to use shared mode for read locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/tdb/common/lock.c

    r10 r41  
    185185                        break;
    186186                case F_RDLCK:
     187                        fAccess = 1; /* read-only */
    187188                case F_WRLCK:
    188189                        fLock = 1;
     
    296297int tdb_brlock_upgrade(struct tdb_context *tdb, tdb_off_t offset, size_t len)
    297298{
    298 #ifdef __OS2__
    299         // YD we use exclusive locks, no need to upgrade.
    300         return 0;
    301 #else
    302299        int count = 1000;
    303300        while (count--) {
    304301                struct timeval tv;
     302#ifdef __OS2__
     303                // YD we cannot upgrade without an unlock first...
     304                tdb_brlock(tdb, offset, F_UNLCK, F_SETLKW, 1, len);
     305#endif
    305306                if (tdb_brlock(tdb, offset, F_WRLCK, F_SETLKW, 1, len) == 0) {
    306307                        return 0;
     
    318319        TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock_upgrade failed at offset %d\n", offset));
    319320        return -1;
    320 #endif
    321321}
    322322
Note: See TracChangeset for help on using the changeset viewer.