Abhishek Jain
Abhishek Jain

Reputation: 10584

What happens if some thread is executing some code from a .so and main thread tries to dlclose it?

What happens if some thread is executing some code from a .so and main thread tries to dlclose it?

I am getting a segmentation fault during unloading an shared object. is that expected?

Upvotes: 0

Views: 115

Answers (1)

Vladimir Kunschikov
Vladimir Kunschikov

Reputation: 1763

dlclose() calls munmap() for the memory segment which being executed by thread and thus being read. Any read from such a memory leads to this fault, so it is expected and proper behavior.

Upvotes: 1

Related Questions