Skip to content

Commit 701d59b

Browse files
committed
---
yaml --- r: 646 b: refs/heads/master c: 5375b39 h: refs/heads/master v: v3
1 parent 3e2ec21 commit 701d59b

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: b03812af2b65a31c567945a1c41515602ff92c20
2+
refs/heads/master: 5375b3916095970bc87675969b2fb00d9bebcfd8

trunk/src/rt/util/indexed_list.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ class indexed_list_object {
1010
int32_t list_index;
1111
};
1212

13+
template<typename T>
14+
class indexed_list_element : public indexed_list_object {
15+
public:
16+
T value;
17+
indexed_list_element(T value) : value(value) {
18+
// Nop;
19+
}
20+
};
21+
1322
/**
1423
* An array list of objects that are aware of their position in the list.
1524
* Normally, objects in this list should derive from the base class

trunk/src/rt/util/synchronized_indexed_list.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ template<typename T> class synchronized_indexed_list :
77
public indexed_list<T> {
88
spin_lock _lock;
99
public:
10-
synchronized_indexed_list(memory_region &region) :
10+
/**
11+
* Clients can use this global lock that is associated with the list to
12+
* perform more coarse grained locking. Internally, the synchronized list
13+
* doesn'tactually make any use of this lock.
14+
*/
15+
spin_lock global;
16+
17+
synchronized_indexed_list(memory_region *region) :
1118
indexed_list<T>(region) {
1219
// Nop.
1320
}
@@ -20,6 +27,13 @@ template<typename T> class synchronized_indexed_list :
2027
return index;
2128
}
2229

30+
bool pop(T **value) {
31+
_lock.lock();
32+
bool result = indexed_list<T>::pop(value);
33+
_lock.unlock();
34+
return result;
35+
}
36+
2337
size_t length() {
2438
size_t length = 0;
2539
_lock.lock();

0 commit comments

Comments
 (0)