| 97 | |
| 98 | template<typename F, typename... Args> |
| 99 | void enqueue(const F func, Args &&...args) { |
| 100 | count++; |
| 101 | if (sync_calls) { |
| 102 | func(toParam(std::forward<Args>(args))...); |
| 103 | } else { |
| 104 | aQueue.enqueue(func, toParam(std::forward<Args>(args))...); |
| 105 | } |
| 106 | #ifndef NDEBUG |
| 107 | sync(); |
| 108 | #else |
| 109 | if (getMemoryPressure() >= getMemoryPressureThreshold() || |
| 110 | count >= 25) { |
| 111 | sync(); |
| 112 | } |
| 113 | #endif |
| 114 | } |
| 115 | |
| 116 | void sync() { |
| 117 | count = 0; |
no test coverage detected