TBM_INFO("surface_queue:%p timedwait error retry wait", surface_queue);
}
} else {
- pthread_mutex_unlock(&surface_queue->lock);
- return TBM_SURFACE_QUEUE_ERROR_NONE;
+ if (surface_queue->impl && surface_queue->impl->need_attach)
+ surface_queue->impl->need_attach(surface_queue);
+ else
+ _tbm_surface_queue_need_attach(surface_queue);
+
+ if (!_queue_is_empty(&surface_queue->free_queue)) {
+ pthread_mutex_unlock(&surface_queue->lock);
+ return TBM_SURFACE_QUEUE_ERROR_NONE;
+ }
}
}
}
if (wait) {
_tbm_surf_queue_mutex_unlock();
- pthread_cond_wait(&surface_queue->free_cond, &surface_queue->lock);
- pthread_mutex_unlock(&surface_queue->lock);
- return 1;
+ while (1) {
+ pthread_cond_wait(&surface_queue->free_cond, &surface_queue->lock);
+
+ if (surface_queue->impl && surface_queue->impl->need_attach)
+ surface_queue->impl->need_attach(surface_queue);
+ else
+ _tbm_surface_queue_need_attach(surface_queue);
+
+ if (!_queue_is_empty(&surface_queue->free_queue)) {
+ pthread_mutex_unlock(&surface_queue->lock);
+ return 1;
+ }
+ }
}
pthread_mutex_unlock(&surface_queue->lock);