简体   繁体   中英

Is std::polar thread safe?

Is the function std::polar() thread safe?

I would like to call the #pragma directive on a for that uses it inside.

Yes, std::polar is thread-safe (for some definition of thread-safe). See [res.on.data.races]/3 :

A C++ standard library function shall not directly or indirectly modify objects (1.10) accessible by threads other than the current thread unless the objects are accessed directly or indirectly via the function's non- const arguments, including this.

Since std::polar only takes const parameters, it does not modify any objects outside the thread that it is called from.

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