Reputation: 6727
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
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