50 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Admin thread starting"));
59 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Admin thread stopping"));
100 QList<TorcAdminObject*> TorcAdminObject::gTorcAdminObjects;
102 QMutex* TorcAdminObject::gTorcAdminObjectsLock =
new QMutex(QMutex::Recursive);
105 : m_nextTorcAdminObject(nullptr),
108 QMutexLocker lock(gTorcAdminObjectsLock);
109 m_nextTorcAdminObject = gTorcAdminObject;
110 gTorcAdminObject =
this;
120 return m_nextTorcAdminObject;
136 QMutexLocker lock(gTorcAdminObjectsLock);
139 if (!gTorcAdminObjects.isEmpty())
141 LOG(VB_GENERAL, LOG_CRIT, QStringLiteral(
"Trying to create admin objects but they already exist!"));
150 gTorcAdminObjects.append(
object);
151 object =
object->GetNextObject();
154 if (gTorcAdminObjects.isEmpty())
159 QList<TorcAdminObject*>::const_iterator it = gTorcAdminObjects.constBegin();
160 for ( ; it != gTorcAdminObjects.constEnd(); ++it)
169 QMutexLocker lock(gTorcAdminObjectsLock);
172 QList<TorcAdminObject*>::const_iterator it = gTorcAdminObjects.constEnd();
173 while (it != gTorcAdminObjects.constBegin())
178 gTorcAdminObjects.clear();
A factory class for automatically running objects outside of the main loop.
TorcAdminObject * GetNextObject(void)
#define TORC_ADMIN_THREAD
static void CreateObjects(void)
Iterates through the list of registered TorcAdminObject's and creates them.
static bool HigherPriority(const TorcAdminObject *Object1, const TorcAdminObject *Object2)
Sort TorcAdminObject's based on relative priorities.
#define LOG(_MASK_, _LEVEL_, _STRING_)
TorcAdminObject(int Priority=TORC_ADMIN_LOW_PRIORITY)
static void DestroyObjects(void)
Destroys each created admin object.
A Torc specific wrapper around QThread.