예제 #1
0
int GlobalMessageQueueList::compact() {
	int *useList = new int[size() + 2];

	for (uint i = 0; i < size() + 2; i++)
		useList[i] = 0;

	for (uint i = 0; i < size();) {
		if (_storage[i]->_isFinished) {
			disableQueueById(_storage[i]->_id);
			remove_at(i);
		} else {
			if ((uint)_storage[i]->_id < size() + 2)
				useList[_storage[i]->_id] = 1;
			i++;
		}
	}

	uint i;

	for (i = 1; i < size() + 2; i++) {
		if (!useList[i])
			break;
	}

	delete [] useList;

	return i;
}
예제 #2
0
void GlobalMessageQueueList::deleteQueueById(int id) {
	for (uint i = 0; i < size(); i++)
		if (_storage[i]->_id == id) {
			remove_at(i);

			disableQueueById(id);
			return;
		}
}
예제 #3
0
void GlobalMessageQueueList::removeQueueById(int id) {
	for (uint i = 0; i < size(); i++)
		if (_storage[i]->_id == id) {
			_storage[i]->_flags &= 0xFD; // It is quite pointless
			remove_at(i);

			disableQueueById(id);
			return;
		}
}
예제 #4
0
int GlobalMessageQueueList::compact() {
	for (uint i = 0; i < size();) {
		if (((MessageQueue *)_storage[i])->_isFinished) {
			disableQueueById(_storage[i]->_id);
			remove_at(i);
		} else {
			i++;
		}
	}

	return size() + 1;
}