Skip to content
Snippets Groups Projects
Commit 27b86547 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix locks for mutex debug mode

parent 975ec61a
No related branches found
No related tags found
No related merge requests found
Pipeline #19397 passed
......@@ -54,9 +54,12 @@ bool Reader::begin() {
}*/
bool Reader::read(int64_t ts, const std::function<void(const ftl::codecs::StreamPacket &, ftl::codecs::Packet &)> &f) {
//UNIQUE_LOCK(mtx_, lk);
#ifdef DEBUG_MUTEX
UNIQUE_LOCK(mtx_, lk);
#else
std::unique_lock<std::mutex> lk(mtx_, std::defer_lock);
if (!lk.try_lock()) return true;
#endif
// Check buffer first for frames already read
for (auto i = data_.begin(); i != data_.end();) {
......
......@@ -65,9 +65,12 @@ bool File::tick(int64_t ts) {
return false;
}
//UNIQUE_LOCK(mtx_, lk);
#ifdef DEBUG_MUTEX
UNIQUE_LOCK(mutex_, lk);
#else
std::unique_lock<std::mutex> lk(mutex_, std::defer_lock);
if (!lk.try_lock()) return true;
#endif
if (jobs_ > 0) {
//LOG(ERROR) << "STILL HAS JOBS";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment