| 133 | |
| 134 | |
| 135 | void SharedLazyTessellationCache::reset() |
| 136 | { |
| 137 | /* lock the reset_state */ |
| 138 | reset_state.lock(); |
| 139 | |
| 140 | /* lock the linked list of thread states */ |
| 141 | linkedlist_mtx.lock(); |
| 142 | |
| 143 | /* block all threads */ |
| 144 | for (ThreadWorkState *t=current_t_state;t!=nullptr;t=t->next) |
| 145 | if (lockThread(t,THREAD_BLOCK_ATOMIC_ADD) != 0) |
| 146 | waitForUsersLessEqual(t,THREAD_BLOCK_ATOMIC_ADD); |
| 147 | |
| 148 | /* reset to the first segment */ |
| 149 | next_block = 0; |
| 150 | #if FORCE_SIMPLE_FLUSH == 1 |
| 151 | switch_block_threshold = maxBlocks; |
| 152 | #else |
| 153 | switch_block_threshold = maxBlocks/NUM_CACHE_SEGMENTS; |
| 154 | #endif |
| 155 | |
| 156 | /* reset local time */ |
| 157 | localTime = NUM_CACHE_SEGMENTS; |
| 158 | |
| 159 | /* release all blocked threads */ |
| 160 | for (ThreadWorkState *t=current_t_state;t!=nullptr;t=t->next) |
| 161 | unlockThread(t,-THREAD_BLOCK_ATOMIC_ADD); |
| 162 | |
| 163 | /* unlock the linked list of thread states */ |
| 164 | linkedlist_mtx.unlock(); |
| 165 | |
| 166 | /* unlock the reset_state */ |
| 167 | reset_state.unlock(); |
| 168 | } |
| 169 | |
| 170 | void SharedLazyTessellationCache::realloc(const size_t new_size) |
| 171 | { |
no test coverage detected