help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is $(file ) thread safe when using option -j ?


From: Paul Smith
Subject: Re: is $(file ) thread safe when using option -j ?
Date: Fri, 12 Sep 2014 14:18:03 -0400

On Fri, 2014-09-12 at 17:43 +0200, Pierre Lindenbaum wrote:
> when using $(file ) 
> http://www.gnu.org/software/make/manual/make.html#File-Function .
> 
> If two targets, built in parallel with option -j, both call
> 
>      $(file >>log.txt, Building $@)
> 
> is $file thead safe or is it possible to obtain a mixture of both 
> messages in the file log.txt ?

GNU make is actually not multithreaded.  It will invoke subprocesses
that run in parallel, but make itself does not use threads.

This means that, as long as you are talking about a single make
invocation, there is no way that multiple instances of file (or any
other make function) will intermingle, and so the content above will
never mix.

If you use recursive make and two make processes are running at the same
time via -j and both use $(file ...) to update the same file, then it's
possible you'll get intermixing of content (but, as long as the length
of the content is small, it's pretty unlikely due to the way the kernel
handles write() system calls).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]