简体   繁体   中英

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++.

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] ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM