[commit: directory] master: add notes about the non-thread-localness of the current directory (#4082) (d84494e)

Simon Marlow marlowsd at gmail.com
Mon Apr 4 14:11:35 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/packages/directory

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d84494e2bc50fd97d78681cbfa11961b7903b93c

>---------------------------------------------------------------

commit d84494e2bc50fd97d78681cbfa11961b7903b93c
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Mon Apr 4 08:52:00 2011 +0100

     add notes about the non-thread-localness of the current directory (#4082)

>---------------------------------------------------------------

 System/Directory.hs |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index d264583..6c28eef 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -862,6 +862,11 @@ Insufficient resources are available to perform the operation.
 * 'UnsupportedOperation'
 The operating system has no notion of current directory.
 
+Note that in a concurrent program, the current directory is global
+state shared between all threads of the process.  When using
+filesystem operations from multiple threads, it is therefore highly
+recommended to use absolute rather than relative `FilePath`s.
+
 -}
 #ifdef __GLASGOW_HASKELL__
 getCurrentDirectory :: IO FilePath
@@ -902,6 +907,11 @@ current directory cannot be dynamically changed.
 The path refers to an existing non-directory object.
 @[ENOTDIR]@
 
+Note that in a concurrent program, the current directory is global
+state shared between all threads of the process.  When using
+filesystem operations from multiple threads, it is therefore highly
+recommended to use absolute rather than relative `FilePath`s.
+
 -}
 
 setCurrentDirectory :: FilePath -> IO ()





More information about the Libraries mailing list