MCPcopy Create free account
hub / github.com/Singular/Singular / lock

Method lock

kernel/oswrapper/vspace.cc:123–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123void FastLock::lock() {
124#ifdef HAVE_CPP_THREADS
125 while (_lock.test_and_set()) {
126 }
127 bool empty = _owner < 0;
128 if (empty) {
129 _owner = vmem.current_process;
130 } else {
131 int p = vmem.current_process;
132 vmem.metapage->process_info[p].next = -1;
133 if (_head < 0)
134 _head = p;
135 else
136 vmem.metapage->process_info[_tail].next = p;
137 _tail = p;
138 }
139 _lock.clear();
140 if (!empty)
141 wait_signal(false);
142#else
143 lock_file(vmem.fd, _offset);
144#endif
145}
146
147void FastLock::unlock() {
148#ifdef HAVE_CPP_THREADS

Callers 9

setJobMethod · 0.45
getTransferMethod · 0.45
getJobMethod · 0.45
lock_allocatorFunction · 0.45
postMethod · 0.45
try_waitMethod · 0.45
waitMethod · 0.45
start_waitMethod · 0.45
stop_waitMethod · 0.45

Calls 3

wait_signalFunction · 0.85
lock_fileFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected