user31264
user31264

Reputation: 6727

Is std::free thread-safe?

According to cppreference.com, std::malloc is thread-safe, but it doesn't say anything about std::free.

Is it thread-safe in Gnu C++ compilier?

I need this because I use libjpeg from C++.

Upvotes: 1

Views: 229

Answers (1)

Kerrek SB
Kerrek SB

Reputation: 477040

Yes,std::free is thread-safe. From [new.delete.dataraces]p1:

For purposes of determining the existence of data races, [...] the C standard library function free [...] shall not introduce a data race ([res.on.data.races]).

Upvotes: 4

Related Questions