Skip to content

Commit

Permalink
Merge pull request #70 from cmzy/main
Browse files Browse the repository at this point in the history
#Bugfix [Crash]: Crashed on multi thread:
  • Loading branch information
caikelun authored Apr 7, 2023
2 parents 40178eb + 018dd74 commit 101437f
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 101437f

Please sign in to comment.