void * FbAuthListThread::Entry() { bool calculate = m_counter.IsEmpty(); FbFrameDatabase database(this, m_counter); if (calculate && abs(m_order) > 1) { CreateCounter(database, m_sql); if (IsClosed()) return NULL; calculate = false; } if (m_info.m_string.IsEmpty()) { DoLetter(database); } else if (m_info.IsFullText()) { DoFullText(database); } else { DoString(database); } if (calculate) { CreateCounter(database, m_sql); } return NULL; }
impl(Mode mode) : m_counter(CreateCounter(mode)), m_prev_time(0.0), m_elapse_time(0.0), m_lap(), m_mode(mode) { }
void * FbDateTreeThread::Entry() { FbFrameDatabase database(this, m_counter); wxString sql = wxT("SELECT DISTINCT created FROM books ORDER BY 1 DESC"); FbSQLite3ResultSet result = database.ExecuteQuery(sql); if (result.IsOk()) MakeModel(result); CreateCounter(database, m_sql); return NULL; }
int CSem::CreateCounter(const char* pszFile, int nCounterNum, int nProj) { int nKey = ftok ( pszFile, nProj ); if ( nKey == -1 ) { snprintf(m_errmsg, sizeof(m_errmsg), "%s=%d,%s", __func__, SEM_ERR_CREATECOUNTER_FTOK, strerror(errno)); return SEM_ERR_CREATECOUNTER_FTOK; } return CreateCounter(nKey, nCounterNum); }
/** * @return the newly created and unique instance of the next best counter * that is deemed safe, or 0 if all have already been created. **/ static ICounter* GetNextBestSafeCounter() { for(;;) { static size_t nextCounterId = 0; ICounter* counter = CreateCounter(nextCounterId++); if(!counter) return 0; // tried all, none were safe Status err = ActivateCounter(counter); if(err == INFO::OK) { debug_printf(L"HRT: using name=%ls freq=%f\n", counter->Name(), counter->NominalFrequency()); return counter; // found a safe counter } else { wchar_t buf[100]; debug_printf(L"HRT: activating %ls failed: %ls\n", counter->Name(), StatusDescription(err, buf, ARRAY_SIZE(buf))); DestroyCounter(counter); } } }