bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module for temporary files in temporary directories


From: Ben Pfaff
Subject: Re: new module for temporary files in temporary directories
Date: Tue, 04 Jul 2006 11:08:56 -0700
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

> 1) The practical reason is that while developing libsigsegv, I noticed that
> C does not have the notion of a "barrier": In code like this:
>
>       set_up_datastructures();
>       /* HERE I would like a barrier */
>       signal(sig,my_signal_handler);
>
> I would like a barrier to ensure that all memory stores of
> set_up_datastructures()  have been performed before the signal handler
> is activated. __asm__("" : : : "memory"); is not portable (works only with
> GCC). Calls to an empty global function are optimized away by GCC 4. [...]

Is it safe to use an external function that is only defined in a
separate translation unit?  For example, to define an empty
function in a source file all by itself, then use a call to it as
a barrier.  This introduces a barrier in the common situations
that I know about, although there is the small overhead of a
call-and-return sequence.  (Are there compilers or linkers that
do inter-module optimization?)
-- 
"Term, holidays, term, holidays, till we leave school,
 and then work, work, work till we die."
C. S. Lewis





reply via email to

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