pthread_mutex_lock(&surface_queue->lock);
if (flush) {
+ surface_queue->queue_size = queue_size;
+
+ if (surface_queue->num_attached == 0) {
+ pthread_mutex_unlock(&surface_queue->lock);
+ _tbm_surf_queue_mutex_unlock();
+ return TBM_SURFACE_QUEUE_ERROR_NONE;
+ }
+
if (surface_queue->modes & TBM_SURFACE_QUEUE_MODE_GUARANTEE_CYCLE) {
/* Destory surface and Push to free_queue */
LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->free_queue.head, item_link)
_queue_init(&surface_queue->free_queue);
surface_queue->num_attached = 0;
- surface_queue->queue_size = queue_size;
if (surface_queue->impl && surface_queue->impl->reset)
surface_queue->impl->reset(surface_queue);