"is createtempfile thread-safe?" Code Answer

2

best way to get your answer is to look at the source code. at first there isn't any synchronization in createtempfile, but to generate the temp file name, it is using securerandom which is threadsafe. then unless you are really unlucky, your file will always get a different name.

on top of that, createtempfile implementation is looping, generating new file name, until the file has been created. the file creation of course is delegated to the native file system operation which we may assume is threadsafe..

By some_guy on February 7 2022

Answers related to “is createtempfile thread-safe?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.