aboutsummaryrefslogtreecommitdiff
path: root/gold/common.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
commit17a1d0a9b26ce8f4f71073c41483baa0c10ed83b (patch)
tree3cdd95751145e2cf1cbcaedee2df8790c86b935d /gold/common.cc
parent7004837e8d2e02ee35c50d236681e9c30a283619 (diff)
downloadgdb-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/common.cc')
-rw-r--r--gold/common.cc30
1 files changed, 8 insertions, 22 deletions
diff --git a/gold/common.cc b/gold/common.cc
index 652dfa1..d94f2c3 100644
--- a/gold/common.cc
+++ b/gold/common.cc
@@ -38,35 +38,21 @@ namespace gold
// This task allocates the common symbols. We need a lock on the
// symbol table.
-Task::Is_runnable_type
-Allocate_commons_task::is_runnable(Workqueue*)
+Task_token*
+Allocate_commons_task::is_runnable()
{
if (!this->symtab_lock_->is_writable())
- return IS_LOCKED;
- return IS_RUNNABLE;
+ return this->symtab_lock_;
+ return NULL;
}
// Return the locks we hold: one on the symbol table, and one blocker.
-class Allocate_commons_task::Allocate_commons_locker : public Task_locker
-{
- public:
- Allocate_commons_locker(Task_token& symtab_lock, Task* task,
- Task_token& blocker, Workqueue* workqueue)
- : symtab_locker_(symtab_lock, task),
- blocker_(blocker, workqueue)
- { }
-
- private:
- Task_locker_write symtab_locker_;
- Task_locker_block blocker_;
-};
-
-Task_locker*
-Allocate_commons_task::locks(Workqueue* workqueue)
+void
+Allocate_commons_task::locks(Task_locker* tl)
{
- return new Allocate_commons_locker(*this->symtab_lock_, this,
- *this->blocker_, workqueue);
+ tl->add(this, this->blocker_);
+ tl->add(this, this->symtab_lock_);
}
// Allocate the common symbols.