简体   繁体   English

std :: free线程安全吗?

[英]Is std::free thread-safe?

According to cppreference.com, std::malloc is thread-safe, but it doesn't say anything about std::free . 根据cppreference.com的说法, std::malloc是线程安全的,但是它并没有说明std::free

Is it thread-safe in Gnu C++ compilier? Gnu C ++编译器中的线程安全吗?

I need this because I use libjpeg from C++. 我需要这个,因为我使用C ++中的libjpeg。

Yes, std::free is thread-safe. 是的, std::free是线程安全的。 From [new.delete.dataraces]p1 : 来自[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] ). 为了确定是否存在数据争用, free的C标准库函数不应引入数据争用( [res.on.data.races] )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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