Angus Leeming wrote:

> There is still no need to have bucket2_ as a class member...
> 
> void LoaderQueue::emptyBucket()
> {
>         cout << "emptying bucket" << endl;
>         std::queue<Cache::ItemPtr> tmp = bucket1_;
>         while (!tmp.empty()) {
>                 addToQueue(tmp.front());
>                 tmp.pop();
>         }
> }

Humm... I think that this doesn't cut it, you cannot copy bucket1_ without
locking it (touch() can be accessing it at the same time, you can end up
with a partially updated queue). If we use swap(), then is merely swapping
pointers, that is supposed to be threads-safe (apart from being faster).
But I'm not at all a threads guru (first application really)... So correct
if I'm wrong. 

> Comment your code. Add a blurb to the top giving the basic philosophy. Add
> files LoaderQueue.[Ch]. Remove GraphicsLoader::checkedStart or whatever
> it's called. Remove GraphicsSupport.[Ch]. Keep going!
 
Will try to. Thanks, Angus!


Reply via email to