-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer fixes #223
base: dev
Are you sure you want to change the base?
Buffer fixes #223
Changes from all commits
eede800
b569c2d
52424d5
521a5d5
3151db3
c054068
e25569b
62bdff2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
#include "AThread.hpp" | ||
#include "Logger.hpp" | ||
|
||
AThread::AThread(int interval) : | ||
AThread::AThread(int interval) : | ||
_interval(interval), | ||
_thread(), | ||
_is_stop(false) {} | ||
|
@@ -21,14 +21,16 @@ void AThread::ThreadMain() { | |
std::mutex mtx; | ||
std::unique_lock<std::mutex> lck(mtx); | ||
|
||
while (!(this->_is_stop)) { | ||
if (!this->Main()) { | ||
DARWIN_LOG_DEBUG("AThread::ThreadMain:: Error in main function, stopping the thread"); | ||
_is_stop = true; | ||
break; | ||
} | ||
while (not this->_is_stop) { | ||
// Wait for notification or until timeout | ||
this->_cv.wait_for(lck, std::chrono::seconds(_interval)); | ||
if (not _is_stop) { | ||
if (not this->Main()) { | ||
DARWIN_LOG_DEBUG("AThread::ThreadMain:: Error in main function, stopping the thread"); | ||
_is_stop = true; | ||
break; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see the logic is mostly hte same, I don't understand the need for a change in this method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the change is in the position of the this->_cv.wait_for() |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modification seems to be done to resolve an issue that I don't know nor can identify the issue, I can't review it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous return didn't specify an error in the process, now it does (and is checked in BufferThread.cpp:34)