flx_ts_collector.hpp

00001 #line 1510 "./lpsrc/flx_gc.pak"
00002 #ifndef __FLX_TS_COLLECTOR_H__
00003 #define __FLX_TS_COLLECTOR_H__
00004 #include "flx_collector.hpp"
00005 #include "pthread_mutex.hpp"
00006 
00007 namespace flx {
00008 namespace gc {
00009 namespace collector {
00010 
00011 /// Naive thread safe Mark and Sweep Collector.
00012 struct PTHREAD_EXTERN flx_ts_collector_t :
00013   public flx::gc::collector::flx_collector_t
00014 {
00015   flx_ts_collector_t(allocator_t *);
00016   ~flx_ts_collector_t();
00017 
00018 private:
00019   /// allocator
00020   void *v_allocate(gc_shape_t *ptr_map, unsigned long);
00021   void v_deallocate(frame_t *frame);
00022 
00023   /// collector (returns number of objects collected)
00024   unsigned long v_collect();
00025 
00026   // add and remove roots
00027   void v_add_root(void *memory);
00028   void v_remove_root(void *memory);
00029 
00030   //
00031   void v_check();
00032   // statistics
00033   unsigned long v_get_allocation_count()const;
00034   unsigned long v_get_root_count()const;
00035   unsigned long v_get_allocation_amt()const;
00036 
00037   void v_compact(bool closed);
00038 
00039 private:
00040   mutable flx::pthread::flx_mutex_t mut;
00041 };
00042 
00043 }}} // end namespaces
00044 #endif
00045 

Generated on Sat May 31 04:06:23 2008 for Felix by  doxygen 1.5.5