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

Method create_process

src/lock/lock.cpp:1726–1804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1724
1725
1726bool LockManager::create_process(CheckStatusWrapper* statusVector)
1727{
1728/**************************************
1729 *
1730 * c r e a t e _ p r o c e s s
1731 *
1732 **************************************
1733 *
1734 * Functional description
1735 * Create a process block.
1736 *
1737 **************************************/
1738 srq* lock_srq;
1739 SRQ_LOOP(m_sharedMemory->getHeader()->lhb_processes, lock_srq)
1740 {
1741 prc* process = (prc*) ((UCHAR*) lock_srq - offsetof(prc, prc_lhb_processes));
1742 if (process->prc_process_id == PID)
1743 {
1744 purge_process(process);
1745 break;
1746 }
1747 }
1748
1749 prc* process = NULL;
1750 if (SRQ_EMPTY(m_sharedMemory->getHeader()->lhb_free_processes))
1751 {
1752 if (!(process = (prc*) alloc(sizeof(prc), statusVector)))
1753 return false;
1754 }
1755 else
1756 {
1757 process = (prc*) ((UCHAR*) SRQ_NEXT(m_sharedMemory->getHeader()->lhb_free_processes) -
1758 offsetof(prc, prc_lhb_processes));
1759 remove_que(&process->prc_lhb_processes);
1760 }
1761
1762 process->prc_type = type_lpr;
1763 process->prc_process_id = PID;
1764 SRQ_INIT(process->prc_owners);
1765 SRQ_INIT(process->prc_lhb_processes);
1766 process->prc_flags = 0;
1767
1768 insert_tail(&m_sharedMemory->getHeader()->lhb_processes, &process->prc_lhb_processes);
1769
1770 if (m_sharedMemory->eventInit(&process->prc_blocking) != FB_SUCCESS)
1771 {
1772 (Arg::StatusVector(statusVector) << Arg::Gds(isc_lockmanerr) <<
1773 Arg::Gds(isc_random) << Arg::Str("process blocking event failed to initialize properly")).copyTo(statusVector);
1774 return false;
1775 }
1776
1777 m_processOffset = SRQ_REL_PTR(process);
1778
1779#if defined HAVE_OBJECT_MAP
1780 m_process = m_sharedMemory->mapObject<prc>(statusVector, m_processOffset);
1781#else
1782 m_process = process;
1783#endif

Callers

nothing calls this directly

Calls 7

GdsClass · 0.85
StrClass · 0.85
eventInitMethod · 0.80
StatusVectorClass · 0.50
getHeaderMethod · 0.45
copyToMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected