void SearchThread::DeleteThread() { // We may be waiting for the condition so we cannot just call Delete m_stopSearch = true; CancelSearch(); // Signal thread to stop waiting wxMutexLocker lock(m_condMutex); m_startSearchCond.Signal(); }
void SearchThread::StartSearch(const wxString& path, const wxString& pattern, bool matchCase, bool regex) { m_path = path; m_pattern = pattern.c_str(); // wxString is not threadsafe, so we have to force copy m_matchCase = matchCase; m_regex = regex; m_lastError = false; // Signal thread that we should start search wxMutexLocker lock(m_condMutex); m_startSearchCond.Signal(); }
wxSemaError wxSemaphoreInternal::Post() { wxMutexLocker locker(m_mutex); if ( m_maxcount > 0 && m_count == m_maxcount ) { return wxSEMA_OVERFLOW; } m_count++; wxLogTrace(TRACE_SEMA, _T("Thread %ld about to signal semaphore, count = %lu"), wxThread::GetCurrentId(), (unsigned long)m_count); return m_cond.Signal() == wxCOND_NO_ERROR ? wxSEMA_NO_ERROR : wxSEMA_MISC_ERROR; }