Esempio n. 1
0
void thread_join()
{
    while(sys.current->next && (sys.current->next != sys.current)){
        Skedule();
    }
    closeTimer();
}
/*************************************************
Function Name: setLabelStatus()
Description: 设置状态标签
*************************************************/
void IMLoginWidget::setLabelStatus(const QString &mes, bool isLogin,
                                   const UserInformation *me)
{
    closeTimer();

    if (isLogin == true)
    {
        m_btnLogin->setEnabled(false);
        m_btnLogin->setText(tr("取消"));
        m_labelStatus->setText(tr("%1").arg(mes));
        if (true == m_cbKeepPwd->isChecked())
        {
            if (!IMClientFileCtrl::writeAutoLogin(
                        AUTO_LOGIN_FILE_NAME,m_leUserID->text(),
                        m_leUserPwd->text(),m_cbAutoLogin->isChecked()))
            {
                qDebug() << "fail to write autoLogin file.";
            }
        }
        else
        {
            if (!IMClientFileCtrl::remove(AUTO_LOGIN_FILE_NAME))
            {
                qDebug() << "fail to write autoLogin file.";
            }
        }

        IMMainWidget *mainWidget = new IMMainWidget(*me);
//        mainWidget->setUserID(m_leUserID->text());
//        mainWidget->setNickname(mes);
//        mainWidget->setLoginStatus(m_status);

        mainWidget->getFriendsInformation();

        mainWidget->show();


//        mainWidget->getLatestMessage();


//        if (m_loginCtrl != NULL)
//        {
//            delete m_loginCtrl;
//            m_loginCtrl = NULL;
//        }
        close();
    }
    else
    {
        m_isLogin = true;
        m_btnLogin->setText(tr("登录"));
        m_labelStatus->setText(mes);
        m_leUserID->setReadOnly(false);
        m_leUserPwd->setReadOnly(false);
    }
}
Esempio n. 3
0
void FileUtils::closeFile(File& file, bool asyncClose) {
  Timer closeTimer(true);
  if (file.file == nullptr) {
    return;
  }
  if (asyncClose) {
    std::thread t([file, closeTimer]() {
      fclose(file.file);
      LOG(INFO) << "Closed file " << file.name;
      GorillaStatsManager::addStatValue(
          kMsPerFileClose, closeTimer.get() / kGorillaUsecPerMs);
    });
    t.detach();
    return;
  }
  fclose(file.file);
  LOG(INFO) << "Closed file " << file.name;
  GorillaStatsManager::addStatValue(
      kMsPerFileClose, closeTimer.get() / kGorillaUsecPerMs);
}
Esempio n. 4
0
void stopTimer()
{
    closeTimer();
}