Skip to content

Commit

Permalink
Add typedef for thread list
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Feb 2, 2014
1 parent d2895ab commit 981a596
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 21 deletions.
10 changes: 5 additions & 5 deletions vm/agent_components.cpp
Expand Up @@ -289,13 +289,13 @@ namespace agent {
virtual void read(Output& output) {
state_->shared().stop_threads_externally();

std::list<ManagedThread*>* threads = state_->shared().threads();
ThreadList* threads = state_->shared().threads();

output.ok("value");

output.e().write_tuple(threads->size());

for(std::list<ManagedThread*>::iterator i = threads->begin();
for(ThreadList::iterator i = threads->begin();
i != threads->end();
++i) {
if(VM* vm = (*i)->as_vm()) {
Expand Down Expand Up @@ -325,11 +325,11 @@ namespace agent {

output.ok("list");

std::list<ManagedThread*>* thrs = state_->shared().threads();
ThreadList* thrs = state_->shared().threads();

output.e().write_tuple(thrs->size());

for(std::list<ManagedThread*>::iterator i = thrs->begin();
for(ThreadList::iterator i = thrs->begin();
i != thrs->end();
++i) {
ManagedThread* thr = *i;
Expand Down Expand Up @@ -374,7 +374,7 @@ namespace agent {

output.ok("value");

std::list<ManagedThread*>* thrs = state_->shared().threads();
ThreadList* thrs = state_->shared().threads();

output.e().write_integer(thrs->size());

Expand Down
4 changes: 2 additions & 2 deletions vm/gc/baker.cpp
Expand Up @@ -192,7 +192,7 @@ namespace rubinius {
}

if(data->threads()) {
for(std::list<ManagedThread*>::iterator i = data->threads()->begin();
for(ThreadList::iterator i = data->threads()->begin();
i != data->threads()->end();
++i) {
scan(*i, true);
Expand Down Expand Up @@ -272,7 +272,7 @@ namespace rubinius {

// Remove unreachable locked objects still in the list
if(data->threads()) {
for(std::list<ManagedThread*>::iterator i = data->threads()->begin();
for(ThreadList::iterator i = data->threads()->begin();
i != data->threads()->end();
++i) {
clean_locked_objects(*i, true);
Expand Down
4 changes: 2 additions & 2 deletions vm/gc/gc.cpp
Expand Up @@ -339,7 +339,7 @@ namespace rubinius {

void GarbageCollector::verify(GCData* data) {
if(data->threads()) {
for(std::list<ManagedThread*>::iterator i = data->threads()->begin();
for(ThreadList::iterator i = data->threads()->begin();
i != data->threads()->end();
++i) {
ManagedThread* thr = *i;
Expand Down Expand Up @@ -396,7 +396,7 @@ namespace rubinius {

void GarbageCollector::scan_fibers(GCData* data, bool marked_only) {
if(data->threads()) {
for(std::list<ManagedThread*>::iterator i = data->threads()->begin();
for(ThreadList::iterator i = data->threads()->begin();
i != data->threads()->end();
++i) {
if(VM* vm = (*i)->as_vm()) {
Expand Down
5 changes: 3 additions & 2 deletions vm/gc/gc.hpp
Expand Up @@ -5,6 +5,7 @@

#include "oop.hpp"
#include "builtin/object.hpp"
#include "shared_state.hpp"

namespace rubinius {

Expand Down Expand Up @@ -32,7 +33,7 @@ namespace rubinius {
capi::Handles* handles_;
std::list<capi::Handle*>* cached_handles_;
GlobalCache* global_cache_;
std::list<ManagedThread*>* threads_;
ThreadList* threads_;
std::list<capi::GlobalHandle*>* global_handle_locations_;
#ifdef ENABLE_LLVM
LLVMState* llvm_state_;
Expand All @@ -49,7 +50,7 @@ namespace rubinius {
return roots_;
}

std::list<ManagedThread*>* threads() {
ThreadList* threads() {
return threads_;
}

Expand Down
4 changes: 2 additions & 2 deletions vm/gc/immix.cpp
Expand Up @@ -167,7 +167,7 @@ namespace rubinius {
}

if(data->threads()) {
for(std::list<ManagedThread*>::iterator i = data->threads()->begin();
for(ThreadList::iterator i = data->threads()->begin();
i != data->threads()->end();
++i) {
scan(*i, false);
Expand Down Expand Up @@ -260,7 +260,7 @@ namespace rubinius {

// Remove unreachable locked objects still in the list
if(data->threads()) {
for(std::list<ManagedThread*>::iterator i = data->threads()->begin();
for(ThreadList::iterator i = data->threads()->begin();
i != data->threads()->end();
++i) {
clean_locked_objects(*i, false);
Expand Down
2 changes: 1 addition & 1 deletion vm/gc/walker.cpp
Expand Up @@ -37,7 +37,7 @@ namespace rubinius {
}

if(data.threads()) {
for(std::list<ManagedThread*>::iterator i = data.threads()->begin();
for(ThreadList::iterator i = data.threads()->begin();
i != data.threads()->end();
++i) {
scan(*i, false);
Expand Down
6 changes: 3 additions & 3 deletions vm/object_memory.cpp
Expand Up @@ -579,7 +579,7 @@ namespace rubinius {
data->global_cache()->prune_young();

if(data->threads()) {
for(std::list<ManagedThread*>::iterator i = data->threads()->begin();
for(ThreadList::iterator i = data->threads()->begin();
i != data->threads()->end();
++i) {
gc::Slab& slab = (*i)->local_slab();
Expand Down Expand Up @@ -795,9 +795,9 @@ namespace rubinius {
handles->deallocate_handles(cached, mark(), young);
}

void ObjectMemory::clear_fiber_marks(std::list<ManagedThread*>* threads) {
void ObjectMemory::clear_fiber_marks(ThreadList* threads) {
if(threads) {
for(std::list<ManagedThread*>::iterator i = threads->begin();
for(ThreadList::iterator i = threads->begin();
i != threads->end();
++i) {
if(VM* vm = (*i)->as_vm()) {
Expand Down
2 changes: 1 addition & 1 deletion vm/object_memory.hpp
Expand Up @@ -368,7 +368,7 @@ namespace rubinius {

void validate_handles(capi::Handles* handles);
void prune_handles(capi::Handles* handles, std::list<capi::Handle*>* cached, BakerGC* young);
void clear_fiber_marks(std::list<ManagedThread*>* threads);
void clear_fiber_marks(ThreadList* threads);

ObjectPosition validate_object(Object* obj);

Expand Down
2 changes: 1 addition & 1 deletion vm/shared_state.cpp
Expand Up @@ -142,7 +142,7 @@ namespace rubinius {
SYNC_TL;

Array* threads = Array::create(state, 0);
for(std::list<ManagedThread*>::iterator i = threads_.begin();
for(ThreadList::iterator i = threads_.begin();
i != threads_.end();
++i) {
if(VM* vm = (*i)->as_vm()) {
Expand Down
6 changes: 4 additions & 2 deletions vm/shared_state.hpp
Expand Up @@ -62,6 +62,8 @@ namespace rubinius {
typedef std::vector<std::string> CApiConstantNameMap;
typedef std_unordered_map<int, capi::Handle*> CApiConstantHandleMap;

typedef std::list<ManagedThread*> ThreadList;

/**
* SharedState represents the global shared state that needs to be shared
* across all VM instances.
Expand All @@ -83,7 +85,7 @@ namespace rubinius {
CApiConstantHandleMap capi_constant_handle_map_;

WorldState* world_;
std::list<ManagedThread*> threads_;
ThreadList threads_;

uint64_t method_count_;
unsigned int class_count_;
Expand Down Expand Up @@ -172,7 +174,7 @@ namespace rubinius {
VM* new_vm();
void remove_vm(VM*);

std::list<ManagedThread*>* threads() {
ThreadList* threads() {
return &threads_;
}

Expand Down

0 comments on commit 981a596

Please sign in to comment.