diff options
author | Ian Lance Taylor <iant@google.com> | 2007-12-14 19:00:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-12-14 19:00:21 +0000 |
commit | 17a1d0a9b26ce8f4f71073c41483baa0c10ed83b (patch) | |
tree | 3cdd95751145e2cf1cbcaedee2df8790c86b935d /gold/archive.cc | |
parent | 7004837e8d2e02ee35c50d236681e9c30a283619 (diff) | |
download | gdb-17a1d0a9b26ce8f4f71073c41483baa0c10ed83b.zip gdb-17a1d0a9b26ce8f4f71073c41483baa0c10ed83b.tar.gz gdb-17a1d0a9b26ce8f4f71073c41483baa0c10ed83b.tar.bz2 |
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.cc | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/gold/archive.cc b/gold/archive.cc index dc12ea9..b80dea5 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 |