diff options
author | Ian Lance Taylor <iant@google.com> | 2006-10-20 20:40:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2006-10-20 20:40:49 +0000 |
commit | 92e059d8dc78c3f65e29e48e368f6e47ea0ab671 (patch) | |
tree | f448eb3317d9cbb0f5946422cc28ef157a5f65cb /gold/workqueue.h | |
parent | af4658dc3db33004d6166b161588221ecb463a5f (diff) | |
download | gdb-92e059d8dc78c3f65e29e48e368f6e47ea0ab671.zip gdb-92e059d8dc78c3f65e29e48e368f6e47ea0ab671.tar.gz gdb-92e059d8dc78c3f65e29e48e368f6e47ea0ab671.tar.bz2 |
Framework for relocation scanning. Implement simple static TLS
relocations.
Diffstat (limited to 'gold/workqueue.h')
-rw-r--r-- | gold/workqueue.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gold/workqueue.h b/gold/workqueue.h index a97d86d..5cce2d5 100644 --- a/gold/workqueue.h +++ b/gold/workqueue.h @@ -288,6 +288,58 @@ class Task run(Workqueue*) = 0; }; +// A simple task which waits for a blocker and then runs a function. + +class Task_function_runner +{ + public: + virtual ~Task_function_runner() + { } + + virtual void + run(Workqueue*) = 0; +}; + +class Task_function : public Task +{ + public: + // Both points should be allocated using new, and will be deleted + // after the task runs. + Task_function(Task_function_runner* runner, Task_token* blocker) + : runner_(runner), blocker_(blocker) + { } + + ~Task_function() + { + delete this->runner_; + delete this->blocker_; + } + + // The standard task methods. + + // Wait until the task is unblocked. + Is_runnable_type + is_runnable(Workqueue*) + { return this->blocker_->is_blocked() ? IS_BLOCKED : IS_RUNNABLE; } + + // This type of task does not normally hold any locks. + virtual Task_locker* + locks(Workqueue*) + { return NULL; } + + // Run the action. + void + run(Workqueue* workqueue) + { this->runner_->run(workqueue); } + + private: + Task_function(const Task_function&); + Task_function& operator=(const Task_function&); + + Task_function_runner* runner_; + Task_token* blocker_; +}; + // The workqueue class Workqueue_runner; @@ -302,6 +354,11 @@ class Workqueue void queue(Task*); + // Add a new task to the front of the work queue. It will be the + // next task to run if it is ready. + void + queue_front(Task*); + // Process all the tasks on the work queue. void process(); |