Added thread factory test - problems in thread

Fixed stupid typo in  TimerManager::start


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664723 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.cc b/lib/cpp/src/concurrency/PosixThreadFactory.cc
index e7f84cd..bac122d 100644
--- a/lib/cpp/src/concurrency/PosixThreadFactory.cc
+++ b/lib/cpp/src/concurrency/PosixThreadFactory.cc
@@ -22,6 +22,8 @@
 
   static const int MB = 1024 * 1024;
 
+  static void* threadMain(void* arg);
+
 private:
 
   pthread_t _pthread;
@@ -36,26 +38,6 @@
 
   Runnable* _runnable;
 
-  static void* threadMain(void* arg) {
-
-    // XXX need a lock here when testing thread state
-
-    PthreadThread* thread = (PthreadThread*)arg;
-
-    if(thread->_state != starting) {
-      return (void*)0;
-    }
-
-    thread->_state = starting;
-
-    thread->_runnable->run();
-
-    if(thread->_state != stopping && thread->_state != stopped) {
-      thread->_state = stopping;
-    }
-    
-    return (void*)0;
-  }
 
 public:
   
@@ -95,9 +77,9 @@
 
     // Set thread priority
 
-    assert(pthread_attr_setschedparam(&thread_attr, &sched_param) == 0);
+    // assert(pthread_attr_setschedparam(&thread_attr, &sched_param) == 0);
 
-    assert(pthread_create(&_pthread, &thread_attr, PthreadThread::threadMain, (void*)this) == 0);
+    assert(pthread_create(&_pthread, &thread_attr, threadMain, (void*)this) == 0);
   }
 
   void join() {
@@ -114,6 +96,26 @@
 
 };
 
+void* PthreadThread::threadMain(void* arg) {
+  // XXX need a lock here when testing thread state
+
+  PthreadThread* thread = (PthreadThread*)arg;
+  
+  if(thread->_state != starting) {
+    return (void*)0;
+  }
+
+  thread->_state = starting;
+
+  thread->_runnable->run();
+
+  if(thread->_state != stopping && thread->_state != stopped) {
+    thread->_state = stopping;
+  }
+    
+  return (void*)0;
+}
+
 /** POSIX Thread factory implementation */
 
 class PosixThreadFactory::Impl {