thread-safetylibmagic

is lib magic thread-safe?


I've been searching around, trying to find an answer. I know that I can create multiple libmagic instances, one for each thread, and that is thread-safe. But can I have a single instance shared between multiple threads?


Solution

  • No, you cannot share libmagic handle/descriptor between two or more threads, in this sense libmagic is not threadsafe.