void Consumer::getWaitNextImage(void* data) { Miro::Guard guard(mutex); ACE_Time_Value timeout(ACE_OS::gettimeofday()); timeout += maxWait; if (cond.wait(&timeout) == -1) throw Miro::ETimeOut(); copyImageData(data, pCurrentImageData); }
void Consumer::getCurrentImage(void* data) { Miro::Guard guard(mutex); if (!pCurrentImageData && running) // we were too fast ;-) { ACE_Time_Value timeout(ACE_OS::gettimeofday()); timeout += maxWait; if (cond.wait(&timeout) == -1) throw Miro::ETimeOut(); } copyImageData(data, pCurrentImageData); }
void DImg::detach() { // are we being shared? if (!m_priv->hasMoreReferences()) { return; } DSharedDataPointer<Private> old = m_priv; m_priv = new Private; copyImageData(old); copyMetaData(old); if (old->data) { size_t size = allocateData(); memcpy(m_priv->data, old->data, size); } }