mutextable (653B)
1 #ifndef _MUTEXTABLE_ 2 #define _MUTEXTABLE_ 3 4 #include "sys/sys" 5 #include "config/config" 6 #include "ThreadsAndMutexes/mutextree/mutextree" 7 8 class MutexTable { 9 public: 10 MutexTable(unsigned sz); 11 MutexTable(MutexTable const &other); 12 ~MutexTable(); 13 14 MutexTable const &operator=(MutexTable const &other); 15 16 void lock(void *o); 17 void unlock(void *o); 18 19 unsigned size() const { return _size; } 20 int weight(unsigned i) const; 21 int balance(unsigned i) const; 22 23 private: 24 void copy(MutexTable const &other); 25 void destroy(); 26 unsigned hash(void *o); 27 28 MutexTree **_table; 29 unsigned _size; 30 }; 31 32 #endif