I know this pattern to read the umask in Python:
current_umask = os.umask(0) # line1
os.umask(current_umask) # line2
return current_umask # line3
But this is not thread-safe.
A thread which executes between line1 and line2 will have a different umask.
Is there a thread-safe way to read the umask in Python?
from Reading umask (thread-safe)
No comments:
Post a Comment