I have a chunk system(pretty much like minecraft). And each chunk ahve to save its state:
- Every couple of minutes
- When its being despawned
Someone mentioned using mutex on the chunk's data(e.g. blocks placed), but I'm not fully convinced, I heard that mutexes can slow program down quite a lot, and in this case, chunk's data will be constantly read and written(for other stuff than just saving and loading).
Should I keep with mutexes, or should I rather make something lock-free, where the other thread will just read the data, copy it and make save out of the copy?