Replace boost::thread with pthread in render,update & vsync thread
[platform/core/uifw/dali-adaptor.git] / adaptors / base / update-thread.h
index ce02a19..2b2b77e 100644 (file)
@@ -1,31 +1,25 @@
 #ifndef __DALI_INTERNAL_UPDATE_THREAD_H__
 #define __DALI_INTERNAL_UPDATE_THREAD_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-
-namespace boost
-{
-
-class thread;
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
-} // namespace boost
+// EXTERNAL INCLUDES
+#include <pthread.h>
 
 namespace Dali
 {
@@ -43,8 +37,7 @@ namespace Adaptor
 
 class UpdateRenderSynchronization;
 class AdaptorInternalServices;
-class TriggerEventInterface;
-class LogOptions;
+class EnvironmentOptions;
 
 /**
  * The update-thread is responsible for calling Core::Update(), and
@@ -58,11 +51,11 @@ public:
    * Create the update-thread; this will not do anything until Start() is called.
    * @param[in] sync An object used to synchronize update & render threads.
    * @param[in] adaptorInterfaces base adaptor interface
-   * @param[in] LogOptions log functions
+   * @param[in] environmentOptions environment options
    */
   UpdateThread(UpdateRenderSynchronization& sync,
                AdaptorInternalServices& adaptorInterfaces,
-               const LogOptions& logOptions );
+               const EnvironmentOptions& environmentOptions );
 
   /**
    * Non-virtual destructor; UpdateThread is not suitable as a base class.
@@ -106,24 +99,31 @@ private:
    */
   void UpdateStatusLogging( unsigned int keepUpdatingStatus, bool renderNeedsUpdate );
 
+  /**
+   * Helper for the thread calling the entry function
+   * @param[in] This A pointer to the current UpdateThread object
+   */
+  static inline void* InternalThreadEntryFunc( void* This )
+  {
+    ( static_cast<UpdateThread*>( This ) )->Run();
+    return NULL;
+  }
+
 private: // Data
 
   UpdateRenderSynchronization&        mUpdateRenderSync;    ///< Used to synchronize the update & render threads
 
   Dali::Integration::Core&            mCore;                ///< Dali core reference
 
-  unsigned int                        mFpsTrackingSeconds;  ///< fps tracking time length in seconds
-  std::vector<float>                  mFpsRecord;           ///< Record of frame rate
-  float                               mElapsedTime;         ///< time elapsed within current second
-  unsigned int                        mElapsedSeconds;      ///< seconds elapsed since the fps tracking started
+  float                               mFpsTrackingSeconds;  ///< fps tracking time length in seconds
+  float                               mFrameCount;          ///< how many frames occurred during tracking period
+  float                               mElapsedTime;         ///< time elapsed from previous fps tracking output
 
   unsigned int                        mStatusLogInterval;   ///< Interval in frames between status debug prints
   unsigned int                        mStatusLogCount;      ///< Used to count frames between status debug prints
 
-  TriggerEventInterface&              mNotificationTrigger; ///< Reference to notification event trigger
-
-  boost::thread*                      mThread;              ///< The actual update-thread.
-  const LogOptions&                   mLogOptions;          ///< Log options
+  pthread_t*                          mThread;              ///< The actual update-thread.
+  const EnvironmentOptions&           mEnvironmentOptions;  ///< environment options
 }; // class UpdateThread
 
 } // namespace Adaptor