File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ class CommandQueueMT {
114
114
uint32_t sync_awaiters = 0 ;
115
115
WorkerThreadPool::TaskID pump_task_id = WorkerThreadPool::INVALID_TASK_ID;
116
116
uint64_t flush_read_ptr = 0 ;
117
+ std::atomic<bool > pending;
117
118
118
119
template <typename T, typename ... Args>
119
120
_FORCE_INLINE_ void create_command (Args &&...p_args) {
@@ -126,6 +127,7 @@ class CommandQueueMT {
126
127
*(uint64_t *)&command_mem[size] = alloc_size;
127
128
void *cmd = &command_mem[size + sizeof (uint64_t )];
128
129
new (cmd) T (std::forward<Args>(p_args)...);
130
+ pending.store (true );
129
131
}
130
132
131
133
template <typename T, bool NeedsSync, typename ... Args>
@@ -186,6 +188,7 @@ class CommandQueueMT {
186
188
}
187
189
188
190
command_mem.clear ();
191
+ pending.store (false );
189
192
flush_read_ptr = 0 ;
190
193
191
194
_prevent_sync_wraparound ();
@@ -226,7 +229,7 @@ class CommandQueueMT {
226
229
}
227
230
228
231
_FORCE_INLINE_ void flush_if_pending () {
229
- if (unlikely (command_mem. size () > 0 )) {
232
+ if (unlikely (pending. load () )) {
230
233
_flush ();
231
234
}
232
235
}
You can’t perform that action at this time.
0 commit comments