[SCM] kodi-pvr-hts/master: make m_lastUse atomic since it's mostly used along other members that don't need mutex protection
tiber-guest at users.alioth.debian.org
tiber-guest at users.alioth.debian.org
Fri Nov 4 23:23:35 UTC 2016
The following commit has been merged in the master branch:
commit f3bd81d0f90744547e55948b1d4a3559391b39a1
Author: Sam Stenvall <sam.stenvall at nordsoftware.com>
Date: Thu Jan 28 11:39:50 2016 +0200
make m_lastUse atomic since it's mostly used along other members
that don't need mutex protection
diff --git a/src/HTSPDemuxer.cpp b/src/HTSPDemuxer.cpp
index fa7758e..1d98470 100644
--- a/src/HTSPDemuxer.cpp
+++ b/src/HTSPDemuxer.cpp
@@ -35,9 +35,9 @@ CHTSPDemuxer::CHTSPDemuxer ( CHTSPConnection &conn )
: m_conn(conn), m_pktBuffer((size_t)-1),
m_seekTime(INVALID_SEEKTIME),
m_subscription(conn),
- m_seeking(false), m_speedChange(false)
+ m_seeking(false), m_speedChange(false),
+ m_lastUse(0)
{
- m_lastUse = 0;
}
CHTSPDemuxer::~CHTSPDemuxer ()
@@ -100,7 +100,7 @@ bool CHTSPDemuxer::Open ( uint32_t channelId, enum eSubscriptionWeight weight )
if (!m_subscription.IsActive())
m_subscription.SendUnsubscribe();
else
- m_lastUse = time(NULL);
+ m_lastUse.store(time(nullptr));
return m_subscription.IsActive();
}
@@ -115,7 +115,8 @@ void CHTSPDemuxer::Close ( void )
DemuxPacket *CHTSPDemuxer::Read ( void )
{
DemuxPacket *pkt = NULL;
- m_lastUse = time(NULL);
+ m_lastUse.store(time(nullptr));
+
if (m_pktBuffer.Pop(pkt, 1000)) {
Logger::Log(LogLevel::LEVEL_TRACE, "demux read idx :%d pts %lf len %lld",
pkt->iStreamId, pkt->pts, (long long)pkt->iSize);
diff --git a/src/Tvheadend.h b/src/Tvheadend.h
index 4c5e2b2..4747f1d 100644
--- a/src/Tvheadend.h
+++ b/src/Tvheadend.h
@@ -49,6 +49,7 @@
#include <queue>
#include <cstdarg>
#include <stdexcept>
+#include <atomic>
extern "C" {
#include <sys/types.h>
@@ -262,7 +263,7 @@ public:
inline time_t GetLastUse() const
{
if (m_subscription.IsActive())
- return m_lastUse;
+ return m_lastUse.load();
return 0;
}
bool IsRealTimeStream() const;
@@ -287,7 +288,7 @@ private:
tvheadend::status::Quality m_signalInfo;
tvheadend::status::TimeshiftStatus m_timeshiftStatus;
tvheadend::Subscription m_subscription;
- time_t m_lastUse;
+ std::atomic<time_t> m_lastUse;
void Close0 ( void );
void Abort0 ( void );
--
kodi-pvr-hts packaging
More information about the pkg-multimedia-commits
mailing list