[Development] Modifying and accessing environment variables in Qt

Simon Hausmann simon.hausmann at theqtcompany.com
Wed Apr 29 10:02:29 CEST 2015


On Tuesday, April 28, 2015 10:26:13 AM Matthew Woehlke wrote:
> On 2015-04-28 04:52, Simon Hausmann wrote:
> > [getenv/setenv not thread safe]
> > 
> > There are various options about what we can do with different degrees of
> > "perfection", but ultimately it's all going to require a compromise. The
> > option that we are favoring at the moment is two-fold:
> > 
> > 1) Policy in Qt is to use the Qt wrappers for accessing the environment
> > (qgetenv, etc.).
> > 
> > 2) These functions we protect with a mutex.
> > 
> > The concrete proposal of change is at
> > 
> > 	https://codereview.qt-project.org/#/c/111158/
> > 
> > What do you think?
> 
> Is there a reason not to use a read/write mutex for this?

In my opinion the overhead of the read-write lock is not worth the prospective 
gain in the unlikely event of repeated concurrent environment access.



Simon



More information about the Development mailing list