8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 08:03:03 +01:00

Remove files that reappeared like ghosts after SF's CVS crash.

This commit is contained in:
robocop 2006-05-14 03:36:30 +00:00
parent 05c420180a
commit a8187ca923
3 changed files with 0 additions and 120 deletions

View File

@ -1,65 +0,0 @@
#ifndef JRD_BLOCK_CACHE_H
#define JRD_BLOCK_CACHE_H
#include "../common/classes/alloc.h"
#include "../common/classes/locks.h"
template <class T>
class BlockCache
{
public:
BlockCache(MemoryPool& p) : pool(p), head(0) {}
~BlockCache();
T* newBlock();
void returnBlock(T*) ;
private:
struct Node
{
Node* next;
};
MemoryPool& pool;
Node* head;
Firebird::Mutex lock;
};
template <class T>
inline T* BlockCache<T>::newBlock()
{
Firebird::MutexLockGuard guard(lock);
if (head)
{
T* result = reinterpret_cast<T*>(head);
head = head->next;
return result;
}
return FB_NEW(pool) T;
}
template<class T>
inline void BlockCache<T>::returnBlock(T* back)
{
Node* returned = reinterpret_cast<Node*>(back);
Firebird::MutexLockGuard guard(lock);
returned->next = head;
head = returned;
}
template <class T>
BlockCache<T>::~BlockCache()
{
// Notice there is no destructor? This is because all our memory
// is allocated from a pool. When the pool gets freed so will our
// storage, simple as that. No need to waste extra processor time
// freeing memory just to have it freed again!
/* Node *next;
while (head)
{
next = head->next;
delete ((T*)head);
head = next;
} */
}
#endif // JRD_BLOCK_CACHE_H

View File

@ -1,15 +0,0 @@
#ifndef JRD_SMP_H
#define JRD_SMP_H
class SmpLock
{
public:
SmpLock() {}
virtual ~SmpLock() {}
virtual void acquire(void) = 0;
virtual void release(void) = 0;
};
#endif // JRD_SMP_H

View File

@ -1,40 +0,0 @@
#ifndef JRD_SMP_IMPL_H
#define JRD_SMP_IMPL_H
#include "../jrd/smp.h"
#include "../jrd/thd.h"
class V4Mutex : public SmpLock
{
public:
V4Mutex()
{
#ifdef V4_THREADING
V4_MUTEX_INIT(&mutex);
#endif
}
~V4Mutex()
{
#ifdef V4_THREADING
V4_MUTEX_DESTROY(&mutex);
#endif
}
virtual void acquire(void)
{
#ifdef V4_THREADING
V4_MUTEX_LOCK(&mutex);
#endif
}
virtual void release(void)
{
#ifdef V4_THREADING
V4_MUTEX_UNLOCK(&mutex);
#endif
}
private:
MUTX_PTR mutex;
};
#endif // JRD_SMP_IMPL_H