| 262 | } |
| 263 | |
| 264 | void FlaxStorage::LockChunks() |
| 265 | { |
| 266 | RETRY: |
| 267 | Platform::InterlockedIncrement(&_chunksLock); |
| 268 | if (Platform::AtomicRead(&_isUnloadingData) != 0) |
| 269 | { |
| 270 | // Someone else is closing file handles or freeing chunks so wait for it to finish and retry |
| 271 | Platform::InterlockedDecrement(&_chunksLock); |
| 272 | do |
| 273 | { |
| 274 | Platform::Sleep(1); |
| 275 | } while (Platform::AtomicRead(&_isUnloadingData) != 0); |
| 276 | goto RETRY; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | FlaxStorage::LockData FlaxStorage::LockSafe() |
| 281 | { |
no test coverage detected