Skip to content

Is fmt::print thread-safe? #1348

@tankiJong

Description

@tankiJong

Hi,

I was testing the code in multiple threads and I observed different behavior for fmt::print:
With code

      fmt::print( fmt::fg( fmt::color::blue ), "worker init\n" );

I got:
image

With code

      fmt::print( fmt::fg( fmt::color::blue ), "worker {} init\n", mId );

I got:
image

Notice that items were missing color. And the only difference in code is just two lines above.

So I am wondering is that because the print is not thread-safe? Or actually some other issues going on.

Thanks for the help :)

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