Date: Wed, 6 Apr 2005 14:22:31 +0900 From: Till Plewe <till@score.is.tsukuba.ac.jp> To: freebsd-questions@freebsd.org Subject: Re: flockfile does not work with stdout (on Message-ID: <20050406052231.GA99716%till@score.is.tsukuba.ac.jp>
next in thread | raw e-mail | index | archive | help
On Tue, Apr 05, 2005 at 10:40:49PM -0500, Dan Nelson wrote: > In the last episode (Apr 06), Till Plewe said: > > How can I control the output of processes (forked from a single > > process) all writing to the same file? > > f{un,}lockfile(file) seems to work unless file=stdout. > > If they are still the same process image (i.e. no execs), you could > mmap some ANONYMOUS|SHARED memory and wait on a flag byte with > atomic_cmpset(). Actually, writing to stdout should be atomic for most > writes (I have never seen gcc output garbled when doing parallel makes > for example). > The life span of each process is quite short (<0.001s) and the system load is fairly high (~40) Thanks, your suggestion works. In fact flockfile also works if I use cons25 instead of {x,ml,...}term. So the culprit may be X. - Till
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050406052231.GA99716%till>