Skip to content

Libmagic can not share handles across threads safely #20

@unclebadtouches

Description

@unclebadtouches

I'm getting a crash in libmagic when using this library with multiple goroutimes. I suspect the reason is because this library keeps a single global handle that is used for all libmagic calls. A quick google search tells me that libmagic handles cannot be shared across threads.

Perhaps a better way to deal with this would be to wrap the libmagic handle as an opaque object that is passed back to the caller from Open(). Close() would also need a receiver or take an opaque handle as an argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions