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

Method post

kernel/oswrapper/vspace.cc:456–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456void Semaphore::post() {
457 int wakeup = -1;
458 internals::ipc_signal_t sig;
459 _lock.lock();
460 if (_head == _tail) {
461 _value++;
462 } else {
463 // don't increment value, as we'll pass that on to the next process.
464 wakeup = _waiting[_head];
465 sig = _signals[_head];
466 next(_head);
467 }
468 _lock.unlock();
469 if (wakeup >= 0) {
470 internals::send_signal(wakeup, sig);
471 }
472}
473
474bool Semaphore::try_wait() {
475 bool result = false;

Callers 5

enqueue_nowaitMethod · 0.45
dequeue_nowaitMethod · 0.45
stop_waitMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Calls 4

nextFunction · 0.85
send_signalFunction · 0.85
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected