// OTHER DEALINGS IN THE SOFTWARE.
//
-#include <algorithm>
-
#include "core/queue.hpp"
#include "core/event.hpp"
#include "pipe/p_screen.h"
pipe_fence_handle *fence = NULL;
if (!queued_events.empty()) {
- // Find out which events have already been signalled.
- auto first = queued_events.begin();
- auto last = std::find_if(queued_events.begin(), queued_events.end(),
- [](event_ptr &ev) { return !ev->signalled(); });
-
- // Flush and fence them.
pipe->flush(pipe, &fence, 0);
- std::for_each(first, last, [&](event_ptr &ev) { ev->fence(fence); });
+
+ while (!queued_events.empty() &&
+ queued_events.front()->signalled()) {
+ queued_events.front()->fence(fence);
+ queued_events.pop_front();
+ }
+
screen->fence_reference(screen, &fence, NULL);
- queued_events.erase(first, last);
}
}
#ifndef CLOVER_CORE_QUEUE_HPP
#define CLOVER_CORE_QUEUE_HPP
+#include <deque>
+
#include "core/object.hpp"
#include "core/context.hpp"
#include "core/timestamp.hpp"
pipe_context *pipe;
typedef ref_ptr<hard_event> event_ptr;
- std::vector<event_ptr> queued_events;
+ std::deque<event_ptr> queued_events;
};
}