Callback* CallbackHandler::FetchFirstCallback() {
	boost::mutex::scoped_lock l(callbackQueueMutex);

	if (!callbackQueue.empty()) {
		for (std::deque<Callback*>::iterator it=callbackQueue.begin(); it!=callbackQueue.end(); it++) {
			Callback* ret = callbackQueue.front();

			if (!ret->IsExecutable()) {
				std::cout << "[SERR] callback not executable (event=" << ret->callbackEvent << ")" << std::endl;
				continue;
			}

			callbackQueue.erase(it);
			return ret;
		}
	}

	return NULL;
}