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

Method getEvent

src/common/os/win32/isc_ipc.cpp:93–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 }
92
93 HANDLE getEvent(SLONG pid, SLONG signal_number)
94 {
95 Firebird::MutexLockGuard guard(&m_mutex, FB_FUNCTION);
96
97 Item* oldestEvent = NULL;
98 FB_UINT64 oldestAge = ~(0ULL);
99
100 Item* evnt = m_events;
101 const Item* const end = evnt + m_count;
102 for (; evnt < end; evnt++)
103 {
104 if (evnt->pid == pid && evnt->signal == signal_number)
105 break;
106
107 if (evnt->age < oldestAge)
108 {
109 oldestEvent = evnt;
110 oldestAge = evnt->age;
111 }
112 }
113
114 if (evnt >= end)
115 {
116 HANDLE handle = ISC_make_signal(false, false, pid, signal_number);
117 if (!handle)
118 return NULL;
119
120 if (m_count < MAX_OPN_EVENTS)
121 m_count++;
122 else
123 {
124 evnt = oldestEvent;
125 CloseHandle(evnt->handle);
126 }
127
128 evnt->pid = pid;
129 evnt->signal = signal_number;
130 evnt->handle = handle;
131 }
132
133 evnt->age = ++m_clock;
134 return evnt->handle;
135 }
136
137private:
138 struct Item

Callers 1

ISC_killFunction · 0.80

Calls 1

ISC_make_signalFunction · 0.85

Tested by

no test coverage detected