213 } |
213 } |
214 |
214 |
215 // Free the buckets in this hashtable |
215 // Free the buckets in this hashtable |
216 void free_buckets(); |
216 void free_buckets(); |
217 |
217 |
|
218 // Helper data structure containing context for the bucket entry unlink process, |
|
219 // storing the unlinked buckets in a linked list. |
|
220 // Also avoids the need to pass around these four members as parameters everywhere. |
|
221 struct BucketUnlinkContext { |
|
222 int _num_processed; |
|
223 int _num_removed; |
|
224 // Head and tail pointers for the linked list of removed entries. |
|
225 BasicHashtableEntry<F>* _removed_head; |
|
226 BasicHashtableEntry<F>* _removed_tail; |
|
227 |
|
228 BucketUnlinkContext() : _num_processed(0), _num_removed(0), _removed_head(NULL), _removed_tail(NULL) { |
|
229 } |
|
230 |
|
231 void free_entry(BasicHashtableEntry<F>* entry); |
|
232 }; |
|
233 // Add of bucket entries linked together in the given context to the global free list. This method |
|
234 // is mt-safe wrt. to other calls of this method. |
|
235 void bulk_free_entries(BucketUnlinkContext* context); |
218 public: |
236 public: |
219 int table_size() { return _table_size; } |
237 int table_size() { return _table_size; } |
220 void set_entry(int index, BasicHashtableEntry<F>* entry); |
238 void set_entry(int index, BasicHashtableEntry<F>* entry); |
221 |
239 |
222 void add_entry(int index, BasicHashtableEntry<F>* entry); |
240 void add_entry(int index, BasicHashtableEntry<F>* entry); |