From 5375b3916095970bc87675969b2fb00d9bebcfd8 Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Tue, 7 Sep 2010 18:22:03 -0700 Subject: Small updates to util classes. --- src/rt/util/synchronized_indexed_list.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/rt/util/synchronized_indexed_list.h') diff --git a/src/rt/util/synchronized_indexed_list.h b/src/rt/util/synchronized_indexed_list.h index ca02f6ef..a7f79a74 100644 --- a/src/rt/util/synchronized_indexed_list.h +++ b/src/rt/util/synchronized_indexed_list.h @@ -7,7 +7,14 @@ template class synchronized_indexed_list : public indexed_list { spin_lock _lock; public: - synchronized_indexed_list(memory_region ®ion) : + /** + * Clients can use this global lock that is associated with the list to + * perform more coarse grained locking. Internally, the synchronized list + * doesn'tactually make any use of this lock. + */ + spin_lock global; + + synchronized_indexed_list(memory_region *region) : indexed_list(region) { // Nop. } @@ -20,6 +27,13 @@ public: return index; } + bool pop(T **value) { + _lock.lock(); + bool result = indexed_list::pop(value); + _lock.unlock(); + return result; + } + size_t length() { size_t length = 0; _lock.lock(); -- cgit v1.2.3