use & instead of * in misc.

Simplify lock.h
This commit is contained in:
Marty Kraimer
2011-02-18 08:17:17 -05:00
parent b0c04eea53
commit 6d3ef2f5b6
18 changed files with 324 additions and 449 deletions

View File

@@ -101,7 +101,7 @@ Thread::ThreadPvt::ThreadPvt(Thread *thread,String name,
: name(name),priority(priority),
runnable(runnable),
isReady(false),
threadNode(thread),
threadNode(*thread),
waitDone(),
id(epicsThreadCreate(
name.c_str(),
@@ -115,8 +115,8 @@ Thread::ThreadPvt::ThreadPvt(Thread *thread,String name,
epicsThreadOnce(&initOnce, &init, 0);
assert(threadList);
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(thread);
Lock x(&listGuard);
threadList->addTail(&threadNode);
Lock x(listGuard);
threadList->addTail(threadNode);
}
Thread::ThreadPvt::~ThreadPvt()
@@ -135,8 +135,8 @@ Thread::ThreadPvt::~ThreadPvt()
message += " is not on threadlist";
throw std::logic_error(message);
}
Lock x(&listGuard);
threadList->remove(&threadNode);
Lock x(listGuard);
threadList->remove(threadNode);
PVDATA_REFCOUNT_MONITOR_DESTRUCT(thread);
}
@@ -165,15 +165,15 @@ ThreadPriority Thread::getPriority()
void Thread::showThreads(StringBuilder buf)
{
Lock x(&listGuard);
Lock x(listGuard);
ThreadListNode *node = threadList->getHead();
while(node!=0) {
Thread *thread = node->getObject();
*buf += thread->getName();
Thread &thread = node->getObject();
*buf += thread.getName();
*buf += " ";
*buf += threadPriorityNames[thread->getPriority()];
*buf += threadPriorityNames[thread.getPriority()];
*buf += "\n";
node = threadList->getNext(node);
node = threadList->getNext(*node);
}
}