Proper Interrupt Handling
This commit is contained in:
@@ -29,6 +29,7 @@ public:
|
||||
_cv.notify_all();
|
||||
}
|
||||
|
||||
// pop and view shoud not be used interchangebly
|
||||
status_t pop() {
|
||||
std::unique_lock ul{_lock};
|
||||
|
||||
@@ -49,6 +50,25 @@ public:
|
||||
return val;
|
||||
}
|
||||
|
||||
// pop and view shoud not be used interchangebly
|
||||
const status_t &view() {
|
||||
std::unique_lock ul{_lock};
|
||||
|
||||
if (!_continue) {
|
||||
return util::false_v<status_t>;
|
||||
}
|
||||
|
||||
while (!_status) {
|
||||
_cv.wait(ul);
|
||||
|
||||
if (!_continue) {
|
||||
return util::false_v<status_t>;
|
||||
}
|
||||
}
|
||||
|
||||
return _status;
|
||||
}
|
||||
|
||||
bool peek() {
|
||||
std::lock_guard lg { _lock };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user