#ifndef	TN_MAP_GRAVEYARD_H
#define TN_MAP_GRAVEYARD_H

#include <set>
#include "foundation/TnTypes.h"
#include "foundation/SharedPtr.h"
#include "foundation/Mutex.h"

class TnMapGraveyard
{
    // Insert an item into the graveyard (other threads may hold references)
public:
    uint32_t Insert(Tn::Foundation::shared_ptr<void> const & ptr);

    // Clear out the graveyard of items without other reference holders
    uint32_t Prune();

private:

    Tn::Foundation::mutex m_mutex;
    
    std::set< Tn::Foundation::shared_ptr<void> > m_graveyard;
};


typedef Tn::Foundation::shared_ptr<TnMapGraveyard> TnMapGraveyardPtr;

#endif
