summaryrefslogtreecommitdiff
path: root/gold/archive.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-12-14 19:00:21 +0000
committerIan Lance Taylor <iant@google.com>2007-12-14 19:00:21 +0000
commit5438a5585056dd94d74935c6c4dec64198f8b4ed (patch)
tree18fdcaf130c78b864380b67274745c261c00ff7a /gold/archive.cc
parent6d8f99e3112365bad0d2cbbec964ae07ac1f2f2d (diff)
downloadbinutils-redhat-5438a5585056dd94d74935c6c4dec64198f8b4ed.tar.gz
Rewrite workqueue. This version eliminates the master thread, and
reduces the amount of locking required to find a new thread to run.
Diffstat (limited to 'gold/archive.cc')
-rw-r--r--gold/archive.cc38
1 files changed, 13 insertions, 25 deletions
diff --git a/gold/archive.cc b/gold/archive.cc
index dc12ea9570..b80dea5713 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -73,12 +73,12 @@ const char Archive::arfmag[2] = { '`', '\n' };
// table.
void
-Archive::setup()
+Archive::setup(Task* task)
{
// We need to ignore empty archives.
if (this->input_file_->file().filesize() == sarmag)
{
- this->input_file_->file().unlock();
+ this->input_file_->file().unlock(task);
return;
}
@@ -109,7 +109,7 @@ Archive::setup()
}
// Opening the file locked it. Unlock it now.
- this->input_file_->file().unlock();
+ this->input_file_->file().unlock(task);
}
// Read the archive symbol map.
@@ -434,33 +434,19 @@ Add_archive_symbols::~Add_archive_symbols()
// Return whether we can add the archive symbols. We are blocked by
// this_blocker_. We block next_blocker_. We also lock the file.
-Task::Is_runnable_type
-Add_archive_symbols::is_runnable(Workqueue*)
+Task_token*
+Add_archive_symbols::is_runnable()
{
if (this->this_blocker_ != NULL && this->this_blocker_->is_blocked())
- return IS_BLOCKED;
- return IS_RUNNABLE;
+ return this->this_blocker_;
+ return NULL;
}
-class Add_archive_symbols::Add_archive_symbols_locker : public Task_locker
-{
- public:
- Add_archive_symbols_locker(Task_token& token, Workqueue* workqueue,
- File_read& file)
- : blocker_(token, workqueue), filelock_(file)
- { }
-
- private:
- Task_locker_block blocker_;
- Task_locker_obj<File_read> filelock_;
-};
-
-Task_locker*
-Add_archive_symbols::locks(Workqueue* workqueue)
+void
+Add_archive_symbols::locks(Task_locker* tl)
{
- return new Add_archive_symbols_locker(*this->next_blocker_,
- workqueue,
- this->archive_->file());
+ tl->add(this, this->next_blocker_);
+ tl->add(this, this->archive_->token());
}
void
@@ -469,6 +455,8 @@ Add_archive_symbols::run(Workqueue*)
this->archive_->add_symbols(this->symtab_, this->layout_,
this->input_objects_);
+ this->archive_->release();
+
if (this->input_group_ != NULL)
this->input_group_->add_archive(this->archive_);
else