Mike Nordell pointed me to the fact that BufferPool::ReleaseBuffers() didn't

free anything if it couldn't acquire the semaphore.
That allowed me to get aware of a possible bug in the destructor :-)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1057 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-09-16 15:07:36 +00:00
parent e49967f361
commit 502d10e3ff

View File

@ -25,15 +25,19 @@ BufferPool::BufferPool()
BufferPool::~BufferPool()
{
delete_sem(fLock);
delete_sem(fFreeBuffers);
acquire_sem(fLock);
// the return value doesn't interest us anymore
void **buffer = fFirstFree;
while (buffer != NULL) {
void **nextBuffer = (void **)*buffer;
free(buffer);
buffer = nextBuffer;
}
delete_sem(fLock);
}