MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / setlock

Method setlock

src/common/isc_sync.cpp:483–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483int FileLock::setlock(const LockMode mode)
484{
485 bool shared = true, wait = true;
486 switch (mode)
487 {
488 case FLM_TRY_EXCLUSIVE:
489 wait = false;
490 // fall through
491 case FLM_EXCLUSIVE:
492 shared = false;
493 break;
494 case FLM_SHARED:
495 break;
496 }
497
498 const LockLevel newLevel = shared ? LCK_SHARED : LCK_EXCL;
499 if (newLevel == level)
500 {
501 return 0;
502 }
503 if (level != LCK_NONE)
504 {
505 return wait ? EBUSY : -1;
506 }
507
508 int rc = file->lock(shared, wait, initFunction);
509 if (rc == 0) // lock taken
510 level = newLevel;
511
512 return rc;
513}
514
515bool FileLock::setlock(CheckStatusWrapper* status, const LockMode mode)
516{

Callers 2

FileLockHolderMethod · 0.80
isc_sync.cppFile · 0.80

Calls 2

errorFunction · 0.70
lockMethod · 0.45

Tested by

no test coverage detected