Change signature of array_list::pop().
This commit is contained in:
parent
6b7ba50e17
commit
b03812af2b
|
@ -400,7 +400,8 @@ rust_task::notify_tasks_waiting_to_join() {
|
|||
while (tasks_waiting_to_join.is_empty() == false) {
|
||||
log(rust_log::TASK, "notify_tasks_waiting_to_join: %d",
|
||||
tasks_waiting_to_join.size());
|
||||
maybe_proxy<rust_task> *waiting_task = tasks_waiting_to_join.pop();
|
||||
maybe_proxy<rust_task> *waiting_task;
|
||||
tasks_waiting_to_join.pop(&waiting_task);
|
||||
if (waiting_task->is_proxy()) {
|
||||
notify_message::send(notify_message::WAKEUP, "wakeup",
|
||||
this, waiting_task->as_proxy());
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
size_t size();
|
||||
int32_t append(T value);
|
||||
int32_t push(T value);
|
||||
T pop();
|
||||
bool pop(T *value);
|
||||
bool replace(T old_value, T new_value);
|
||||
int32_t index_of(T value);
|
||||
bool is_empty();
|
||||
|
@ -54,10 +54,17 @@ array_list<T>::push(T value) {
|
|||
return _size - 1;
|
||||
}
|
||||
|
||||
template<typename T> T
|
||||
array_list<T>::pop() {
|
||||
T value = _data[-- _size];
|
||||
return value;
|
||||
template<typename T> bool
|
||||
array_list<T>::pop(T *value) {
|
||||
if (_size == 0) {
|
||||
return false;
|
||||
}
|
||||
if (value != NULL) {
|
||||
*value = _data[-- _size];
|
||||
} else {
|
||||
-- _size;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,7 @@ template<typename T> class indexed_list {
|
|||
public:
|
||||
indexed_list(memory_region ®ion) : region(region) {}
|
||||
virtual int32_t append(T *value);
|
||||
virtual bool pop(T **value);
|
||||
virtual size_t length() {
|
||||
return list.size();
|
||||
}
|
||||
|
@ -48,7 +49,8 @@ indexed_list<T>::remove(T *value) {
|
|||
assert (value->list_index >= 0);
|
||||
assert (value->list_index < (int32_t)list.size());
|
||||
int32_t removeIndex = value->list_index;
|
||||
T *last = list.pop();
|
||||
T *last;
|
||||
list.pop(&last);
|
||||
if (last->list_index == removeIndex) {
|
||||
last->list_index = -1;
|
||||
return removeIndex;
|
||||
|
@ -60,6 +62,11 @@ indexed_list<T>::remove(T *value) {
|
|||
}
|
||||
}
|
||||
|
||||
template<typename T> bool
|
||||
indexed_list<T>::pop(T **value) {
|
||||
return list.pop(value);
|
||||
}
|
||||
|
||||
template <typename T> T *
|
||||
indexed_list<T>::operator[](int32_t index) {
|
||||
T *value = list[index];
|
||||
|
|
Loading…
Reference in New Issue