Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#Bugfix [Crash]: Crashed on multi thread: #70

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bytehook/src/main/cpp/bh_elf_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ void bh_elf_manager_refresh(bh_elf_manager_t *self, bool sync_clean, bh_elf_mana
}
}

// unlock ELFs-tree
pthread_rwlock_unlock(&self->elfs_lock);

// if we are in sync-clean status, no other iterate or hooks can be performed at the same time
if (sync_clean) {
// remove and destroy all unreferenced ELF object in the abandoned list
Expand All @@ -212,6 +209,9 @@ void bh_elf_manager_refresh(bh_elf_manager_t *self, bool sync_clean, bh_elf_mana
}
}

// unlock ELFs-tree
pthread_rwlock_unlock(&self->elfs_lock);

// do callback for newborn ELFs (no need to lock)
if (NULL != cb) {
TAILQ_FOREACH_SAFE(elf, &new_elfs, link_list, elf_tmp) {
Expand Down