The swap pointer should be NULLed after being fetched by another thread. The getter function should get a mutex that protects the pointer while being NULLed. After the swap has occurred in the fetcher-thread, the pointer can be written back to the item. This guarantees that no other thread accesses the current swap pointer while one of the cache threads writes new image data.