| 598 | |
| 599 | |
| 600 | void LCK_init(thread_db* tdbb, enum lck_owner_t owner_type) |
| 601 | { |
| 602 | /************************************** |
| 603 | * |
| 604 | * L C K _ i n i t |
| 605 | * |
| 606 | ************************************** |
| 607 | * |
| 608 | * Functional description |
| 609 | * Initialize the locking stuff for the given owner. |
| 610 | * |
| 611 | **************************************/ |
| 612 | LOCK_OWNER_T owner_id; |
| 613 | SLONG* owner_handle_ptr = 0; |
| 614 | |
| 615 | SET_TDBB(tdbb); |
| 616 | Database* const dbb = tdbb->getDatabase(); |
| 617 | |
| 618 | switch (owner_type) |
| 619 | { |
| 620 | case LCK_OWNER_database: |
| 621 | owner_id = LCK_OWNER_ID_DBB(tdbb); |
| 622 | owner_handle_ptr = LCK_OWNER_HANDLE_DBB(tdbb); |
| 623 | break; |
| 624 | |
| 625 | case LCK_OWNER_attachment: |
| 626 | owner_id = LCK_OWNER_ID_ATT(tdbb); |
| 627 | owner_handle_ptr = LCK_OWNER_HANDLE_ATT(tdbb); |
| 628 | break; |
| 629 | |
| 630 | default: |
| 631 | bug_lck("Invalid lock owner type in LCK_init ()"); |
| 632 | break; |
| 633 | } |
| 634 | |
| 635 | FbLocalStatus statusVector; |
| 636 | |
| 637 | if (!dbb->lockManager()->initializeOwner(&statusVector, owner_id, owner_type, owner_handle_ptr)) |
| 638 | { |
| 639 | if (statusVector[1] == isc_lockmanerr) |
| 640 | { |
| 641 | statusVector.copyTo(tdbb->tdbb_status_vector); |
| 642 | tdbb->getDatabase()->dbb_flags |= DBB_bugcheck; |
| 643 | } |
| 644 | |
| 645 | statusVector.raise(); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | |
| 650 | bool LCK_lock(thread_db* tdbb, Lock* lock, USHORT level, SSHORT wait) |
no test coverage detected