void detector_wait(UI thread, pthread_mutex_t *mutex) { int tid = get_thread_id(thread), mid = get_mutex_id(mutex); go[tid] = mid; if (detector_detect(tid)) { fprintf(fout, "Caused by thread %d wait pthread_mutex_t %d\n", tid, mid); exit(0); } }
void memory_journal::try_acquire_failed( sequence_journal_handle sequenceHandle, mutex_journal_handle mutexHandle) { sequence_journal_entry sequenceEntry; sequenceEntry.m_type = journal_entry_e::TryAcquireFailed; sequenceEntry.m_mutexId = get_mutex_id(mutexHandle); sequenceHandle->m_journal.push_back(sequenceEntry); }
void memory_journal::try_acquire_succeeded( sequence_journal_handle sequenceHandle, mutex_journal_handle mutexHandle) { mutex_journal_entry mutexEntry; mutexEntry.m_sequenceId = get_sequence_id(sequenceHandle); mutexHandle->m_journal.push_back(mutexEntry); sequence_journal_entry sequenceEntry; sequenceEntry.m_type = journal_entry_e::TryAcquireSucceeded; sequenceEntry.m_mutexId = get_mutex_id(mutexHandle); sequenceHandle->m_journal.push_back(sequenceEntry); }
void memory_journal::acquired( sequence_journal_handle sequenceHandle, mutex_journal_handle mutexHandle, lock_id_type lockId) { mutex_journal_entry mutexEntry; mutexEntry.m_sequenceId = get_sequence_id(sequenceHandle); mutexHandle->m_journal.push_back(mutexEntry); sequence_journal_entry sequenceEntry; sequenceEntry.m_type = journal_entry_e::LockAcquired; sequenceEntry.m_mutexId = get_mutex_id(mutexHandle); sequenceEntry.m_lockId = lockId; sequenceHandle->m_journal.push_back(sequenceEntry); }
void detector_delete(pthread_mutex_t *mutex) { int id = get_mutex_id(mutex); mutex_set[id] = -1; go[id] = -1; }
int detector_mutex_free(pthread_mutex_t *mutex) { int mid = get_mutex_id(mutex); return mutex_set[mid] == -1; }
void detector_hold(UI thread, pthread_mutex_t *mutex) { UI tid = get_thread_id(thread), mid = get_mutex_id(mutex); mutex_set[mid] = 1; go[mid] = tid; go[tid] = -1; }