Skip to content

Make different objects safe to use from different threads #96

@maglar0

Description

@maglar0

The C++ documentation says

Threading

None of the code is thread-safe, by design. That said, since currently a FlatBuffer is read-only and entirely const, reading by multiple threads is possible.

This sounds problematic, one might want to use Flatbuffers for example from a network communication thread while at the same time writing preferences to disk in another thread. I can't find anything in the code during a quick glance that would go bad by doing that (global variables, function static variables etc), but since it's not guaranteed to work obviously I can't use it.

Is it actually safe to use different objects from different threads? In that case I think the documentation should be clearer about that. Otherwise I also think the documentation should be clearer about that, maybe including a short explanation as to why such a (very reasonable) thread safety guarantee is impossible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions