static void tSystemMessage(int priority, const char *msg, va_list ap)
{
    static QSystemSemaphore semaphore("TreeFrogSystemLog", 1, QSystemSemaphore::Open);
    TLog log(priority, QString().vsprintf(msg, ap).toLocal8Bit());
    QByteArray buf = TLogger::logToByteArray(log, syslogLayout, syslogDateTimeFormat);

    semaphore.acquire();  // Acquires the semaphore for system log
    if (!systemLog.fileName().isEmpty() && systemLog.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
        systemLog.write(buf.data());
        systemLog.flush();
        systemLog.close();
    }
    semaphore.release();  // Releases the semaphore
}
 HbCacheLocker(QSystemSemaphore &semaphore) : semaphore(semaphore)
 {
     semaphore.acquire();
 }
示例#3
0
bool acquire_jt9_() {return sem_jt9.acquire();}