/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2022 Samsung Electronics Co., Ltd. All rights reserved.
*
* This file is licensed under the terms of MIT License or the Apache License
* Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
void ServiceThread::ThreadLoop() {
for (;;) {
- EventDescription description = {NULL, NULL};
+ EventDescription description;
{
std::unique_lock<std::mutex> ulock(m_eventQueueMutex);
- if (m_quit)
- return;
- if (!m_eventQueue.empty()) {
- description = m_eventQueue.front();
- m_eventQueue.pop();
- } else {
+ for (;;) {
+ if (m_quit)
+ return;
+ if (!m_eventQueue.empty()) {
+ description = m_eventQueue.front();
+ m_eventQueue.pop();
+ break;
+ }
m_waitCondition.wait(ulock);
}
}
- if (description.eventPtr != NULL) {
- UNHANDLED_EXCEPTION_HANDLER_BEGIN
- {
- (this->*description.eventFunctionPtr)(description);
- delete description.eventPtr;
- }
- UNHANDLED_EXCEPTION_HANDLER_END
+ UNHANDLED_EXCEPTION_HANDLER_BEGIN
+ {
+ (this->*description.eventFunctionPtr)(description);
+ delete description.eventPtr;
}
+ UNHANDLED_EXCEPTION_HANDLER_END
}
}