MCPcopy Create free account
hub / github.com/creatale/node-dv / AwaitEvent

Method AwaitEvent

deps/tesseract/viewer/scrollview.cpp:449–466  ·  view source on GitHub ↗

Block until an event of the given type is received. Note: The calling function is responsible for deleting the returned SVEvent afterwards!

Source from the content-addressed store, hash-verified

447/// Note: The calling function is responsible for deleting the returned
448/// SVEvent afterwards!
449SVEvent* ScrollView::AwaitEvent(SVEventType type) {
450 // Initialize the waiting semaphore.
451 SVSemaphore* sem = new SVSemaphore();
452 std::pair<ScrollView*, SVEventType> ea(this, type);
453 waiting_for_events_mu->Lock();
454 waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, (SVEvent*)0);
455 waiting_for_events_mu->Unlock();
456 // Wait on it, but first flush.
457 stream_->Flush();
458 sem->Wait();
459 // Process the event we got woken up for (its in waiting_for_events pair).
460 waiting_for_events_mu->Lock();
461 SVEvent* ret = waiting_for_events[ea].second;
462 waiting_for_events.erase(ea);
463 delete sem;
464 waiting_for_events_mu->Unlock();
465 return ret;
466}
467
468// Block until any event on any window is received.
469// No event is returned here!

Callers 9

DisplaySamplesMethod · 0.80
DebugDisplayMethod · 0.80
GetClassToDebugMethod · 0.80
pgeditor_mainMethod · 0.80
ComputeNonTextMaskMethod · 0.80
FindBlocksMethod · 0.80
~StrokeWidthMethod · 0.80
SVPaintMethod · 0.80
window_waitFunction · 0.80

Calls 5

FlushMethod · 0.80
WaitMethod · 0.80
eraseMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected