RE: Question around GOnce structure in Glib



Hi James,
	Thanks for the update. No, LSB does not want to do that. I was
merely trying to understand why it was done that way. This will be first
time LSB has encountered volatile member function, and we will need to
support it in our infrastructure.

Thanks again,

-Rajesh

> -----Original Message-----
> From: James Henstridge [mailto:james jamesh id au]
> Sent: Wednesday, September 21, 2005 9:55 PM
> To: Banginwar, Rajesh
> Cc: gtk-devel-list gnome org
> Subject: Re: Question around GOnce structure in Glib
> 
> Banginwar, Rajesh wrote:
> 
> > Hello,
> >
> >             We are currently in the process of standardizing GTK+
> > libraries in LSB-Desktop project. During the process, I ran into the
> > GOnce structure in Glib library. I will like to understand why the
> > member variables of this structure are declared volatile. I am
trying
> > to find out if LSB should maintain these member volatile or if it is
> > ok not to.
> >
> The struct members are marked volatile because they may be
concurrently
> accessed by other threads.  One of the g_once() implementations checks
> one of the member variables outside of the protecting mutex (in a way
> that is safe, given how this code works), so you don't want the
compiler
> to generate code that assumes the variable won't change underneath it.
> 
> That said, why would an LSB standard want to document something
> different to the interface glib actually provides?
> 
> James.



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