]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gold/descriptors.cc
2009-03-23 Ian Lance Taylor <iant@google.com>
[thirdparty/binutils-gdb.git] / gold / descriptors.cc
index b05bdf1a89d1031d9e7313bd41f5e5281662b952..3d059e2c222ed79a02157d282d9a2d70d4ddce55 100644 (file)
@@ -51,8 +51,8 @@ namespace gold
 // adjusted downward if we run out of file descriptors.
 
 Descriptors::Descriptors()
-  : lock_(NULL), open_descriptors_(), stack_top_(-1), current_(0),
-    limit_(8192 - 16)
+  : lock_(NULL), initialize_lock_(&this->lock_), open_descriptors_(),
+    stack_top_(-1), current_(0), limit_(8192 - 16)
 {
   this->open_descriptors_.reserve(128);
 }
@@ -66,13 +66,9 @@ Descriptors::open(int descriptor, const char* name, int flags, int mode)
   // initialize a Lock until we have parsed the options to find out
   // whether we are running with threads.  We can be called before
   // options are valid when reading a linker script.
-  if (this->lock_ == NULL)
-    {
-      if (parameters->options_valid())
-       this->lock_ = new Lock();
-      else
-       gold_assert(descriptor < 0);
-    }
+  bool lock_initialized = this->initialize_lock_.initialize();
+
+  gold_assert(lock_initialized || descriptor < 0);
 
   if (descriptor >= 0)
     {