merge with master
[platform/framework/web/wrt-plugins-common.git] / src / Commons / ThreadPool.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 5ec65eb..fd5cd3a
@@ -30,7 +30,6 @@
 
 namespace WrtDeviceApis {
 namespace Commons {
-
 ThreadPool &ThreadPool::getInstance()
 {
     static ThreadPool theInstance;
@@ -38,7 +37,7 @@ ThreadPool &ThreadPool::getInstance()
 }
 
 DPL::Event::AbstractEventDispatcher *ThreadPool::getDispatcher(
-        DPL::Event::ThreadEventDispatcher &callingThreadDispatcher)
+    DPL::Event::ThreadEventDispatcher &callingThreadDispatcher)
 {
     DPL::Thread *currentThread = DPL::Thread::GetCurrentThread();
     //if we are in main thread
@@ -50,8 +49,7 @@ DPL::Event::AbstractEventDispatcher *ThreadPool::getDispatcher(
 }
 
 ThreadPool::ThreadPool()
-{
-}
+{}
 
 ThreadPool::~ThreadPool()
 {
@@ -63,7 +61,7 @@ ThreadPool::~ThreadPool()
 }
 
 DPL::Thread* ThreadPool::getThreadHandleCreateIfNotExists(
-        ThreadEnum::Enumeration type)
+    ThreadEnum::Enumeration type)
 {
     DPL::Mutex::ScopedLock lock(&m_threadHandlersMutex);
     ThreadHandleMap::iterator element = m_threadHandlers.find(type);
@@ -73,7 +71,7 @@ DPL::Thread* ThreadPool::getThreadHandleCreateIfNotExists(
         DPL::Thread* newThread = new DPL::Thread();
         m_threadHandlers.insert(
             m_threadHandlers.begin(),
-            std::pair<ThreadEnum::Enumeration,DPL::Thread*>(type, newThread));
+            std::pair<ThreadEnum::Enumeration, DPL::Thread*>(type, newThread));
         newThread->Run();
         return newThread;
     }
@@ -88,7 +86,8 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type)
     }
     /* we could stay with
      * getThreadHandleCreateIfNotExists(type);
-     * but by switch we can attach actually one thread to more than one ThreadEnums
+     * but by switch we can attach actually one thread to more than one
+     * ThreadEnums
      */
     switch (type) {
     case ThreadEnum::NULL_THREAD:
@@ -155,13 +154,15 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type)
         thandle = getThreadHandleCreateIfNotExists(ThreadEnum::POWER_THREAD);
         break;
     case ThreadEnum::PLUGIN_TEMPLETE_THREAD:
-        thandle = getThreadHandleCreateIfNotExists(ThreadEnum::PLUGIN_TEMPLETE_THREAD);
+        thandle = getThreadHandleCreateIfNotExists(
+                ThreadEnum::PLUGIN_TEMPLETE_THREAD);
         break;
     case ThreadEnum::BLUETOOTH_THREAD:
         thandle = getThreadHandleCreateIfNotExists(ThreadEnum::BLUETOOTH_THREAD);
         break;
     case ThreadEnum::APPLICATION_THREAD:
-        thandle = getThreadHandleCreateIfNotExists(ThreadEnum::APPLICATION_THREAD);
+        thandle = getThreadHandleCreateIfNotExists(
+                ThreadEnum::APPLICATION_THREAD);
         break;
     case ThreadEnum::GYROSCOPE_THREAD:
         thandle = getThreadHandleCreateIfNotExists(ThreadEnum::GYROSCOPE_THREAD);
@@ -170,19 +171,23 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type)
         thandle = getThreadHandleCreateIfNotExists(ThreadEnum::CLOCK_THREAD);
         break;
     case ThreadEnum::SYSTEMINFO_THREAD:
-        thandle = getThreadHandleCreateIfNotExists(ThreadEnum::SYSTEMINFO_THREAD);
+        thandle = getThreadHandleCreateIfNotExists(
+                ThreadEnum::SYSTEMINFO_THREAD);
         break;
     case ThreadEnum::CALLHISTORY_THREAD:
-        thandle = getThreadHandleCreateIfNotExists(ThreadEnum::CALLHISTORY_THREAD);
+        thandle = getThreadHandleCreateIfNotExists(
+                ThreadEnum::CALLHISTORY_THREAD);
         break;
     case ThreadEnum::ACCOUNT_THREAD:
-        thandle = getThreadHandleCreateIfNotExists(ThreadEnum::CALLHISTORY_THREAD);
+        thandle = getThreadHandleCreateIfNotExists(
+                ThreadEnum::CALLHISTORY_THREAD);
         break;
     case ThreadEnum::NFC_THREAD:
         thandle = getThreadHandleCreateIfNotExists(ThreadEnum::NFC_THREAD);
         break;
     case ThreadEnum::MEDIACONTENT_THREAD:
-        thandle = getThreadHandleCreateIfNotExists(ThreadEnum::MEDIACONTENT_THREAD);
+        thandle = getThreadHandleCreateIfNotExists(
+                ThreadEnum::MEDIACONTENT_THREAD);
         break;
     case ThreadEnum::SE_THREAD:
         thandle = getThreadHandleCreateIfNotExists(ThreadEnum::SE_THREAD);
@@ -203,6 +208,5 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type)
     }
     return thandle;
 }
-
 }
 } // WrtDeviceApisCommon