English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Unix module and threads
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-05 (13:43)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Unix module and threads
On Sun, 05 Sep 2004, Janne Hellsten wrote:
> I wonder what happens if I call [Unix.chdir foo] from two different 
> threads, with two different directories?

This is not thread-safe: threads share the current working directory of
the process.

> After chdir I typicall call [Unix.system] and/or 
> [Unix.open_process_full] and expect the directory to be the one just 
> previously set with [Unix.chdir].
> I would like to parallelize a simple building tool that I've written, 
> but I'm a bit worried if things will mysteriously break with the 
> introduction of multi-threaded control.

Always use absolute paths to avoid problems in multi-threaded contexts.


Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners