projects
/
platform
/
upstream
/
binutils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add tests for PR ld/16452 and PR ld/16457
[platform/upstream/binutils.git]
/
gold
/
descriptors.h
diff --git
a/gold/descriptors.h
b/gold/descriptors.h
index
1933314
..
c14ac07
100644
(file)
--- a/
gold/descriptors.h
+++ b/
gold/descriptors.h
@@
-1,6
+1,6
@@
// descriptors.h -- manage file descriptors for gold -*- C++ -*-
// descriptors.h -- manage file descriptors for gold -*- C++ -*-
-// Copyright
2008, 2009
Free Software Foundation, Inc.
+// Copyright
(C) 2008-2014
Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@
-25,11
+25,11
@@
#include <vector>
#include <vector>
+#include "gold-threads.h"
+
namespace gold
{
namespace gold
{
-class Lock;
-
// This class manages file descriptors for gold.
class Descriptors
// This class manages file descriptors for gold.
class Descriptors
@@
-56,6
+56,10
@@
class Descriptors
void
release(int descriptor, bool permanent);
void
release(int descriptor, bool permanent);
+ // Close all the descriptors open for reading.
+ void
+ close_all();
+
private:
// Information kept for a descriptor.
struct Open_descriptor
private:
// Information kept for a descriptor.
struct Open_descriptor
@@
-69,6
+73,8
@@
class Descriptors
bool inuse;
// Whether this is a write descriptor.
bool is_write;
bool inuse;
// Whether this is a write descriptor.
bool is_write;
+ // Whether the descriptor is on the stack.
+ bool is_on_stack;
};
bool
};
bool
@@
-76,6
+82,8
@@
class Descriptors
// We need to lock before accessing any fields.
Lock* lock_;
// We need to lock before accessing any fields.
Lock* lock_;
+ // Used to initialize the lock_ field exactly once.
+ Initialize_lock initialize_lock_;
// Information for descriptors.
std::vector<Open_descriptor> open_descriptors_;
// Top of stack.
// Information for descriptors.
std::vector<Open_descriptor> open_descriptors_;
// Top of stack.
@@
-100,6
+108,10
@@
inline void
release_descriptor(int descriptor, bool permanent)
{ descriptors.release(descriptor, permanent); }
release_descriptor(int descriptor, bool permanent)
{ descriptors.release(descriptor, permanent); }
+inline void
+close_all_descriptors()
+{ descriptors.close_all(); }
+
} // End namespace gold.
#endif // !defined(GOLD_DESCRIPTORS_H)
} // End namespace gold.
#endif // !defined(GOLD_DESCRIPTORS_H)