forked from cellular-infrastructure/osmo-pcu
ms: Add is_idle() method to GprsMs::Guard
Currently there is no simple way to determine, whether the MS object protected by a guard will continue to exist after the guard object is destroyed. This patch adds a is_idle() method that will return true if the MS object is just kept by the guard from being idle. In that case, the MS object would either be deleted or return true for GprsMs::is_idle() after the guard's destruction, provided that no TBF attachment took place in between. Sponsored-by: On-Waves ehf
This commit is contained in:
parent
3a10dbd564
commit
b2439bbb8a
|
@ -62,6 +62,14 @@ GprsMs::Guard::~Guard()
|
|||
m_ms->unref();
|
||||
}
|
||||
|
||||
bool GprsMs::Guard::is_idle() const
|
||||
{
|
||||
if (!m_ms)
|
||||
return true;
|
||||
|
||||
return !m_ms->m_ul_tbf && !m_ms->m_dl_tbf && m_ms->m_ref == 1;
|
||||
}
|
||||
|
||||
void GprsMs::timeout(void *priv_)
|
||||
{
|
||||
GprsMs *ms = static_cast<GprsMs *>(priv_);
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
Guard(GprsMs *ms);
|
||||
~Guard();
|
||||
|
||||
bool is_idle() const;
|
||||
|
||||
private:
|
||||
GprsMs * const m_ms;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue