Hello !
I'm just about finished designing my resource-cache-manager, and I kinda got stuck when thinking about multithreading:
I have multiple threads in my engine.. each possibly requesting cache items anytime throughout the play... Now my "CCacheItem" class is a bit complex and it will not support nicelly if 2 threads call some member functions simultaneously.
So.. I began wondering.. is there a big (performance-wise) penalty for declaring a mutex for each cache resource? about ~500 items at one time..
The alternative would be to have 1 mutex for the cache manager's "GET" function. But then I can only serve 1 item from the cache which is a bit beyond the scope of having this complex structure in the first place...
Any ideeas?
I'm just about finished designing my resource-cache-manager, and I kinda got stuck when thinking about multithreading:
I have multiple threads in my engine.. each possibly requesting cache items anytime throughout the play... Now my "CCacheItem" class is a bit complex and it will not support nicelly if 2 threads call some member functions simultaneously.
So.. I began wondering.. is there a big (performance-wise) penalty for declaring a mutex for each cache resource? about ~500 items at one time..
The alternative would be to have 1 mutex for the cache manager's "GET" function. But then I can only serve 1 item from the cache which is a bit beyond the scope of having this complex structure in the first place...
Any ideeas?
Quisquis latium dictio gravis videre