1 #ifndef __DALI_INTERNAL_UPDATE_THREAD_H__
2 #define __DALI_INTERNAL_UPDATE_THREAD_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <base/fps-tracker.h>
26 #include <base/update-status-logger.h>
42 class ThreadSynchronization;
43 class AdaptorInternalServices;
44 class EnvironmentOptions;
47 * The update-thread is responsible for calling Core::Update(), and
48 * for triggering the render-thread after each update.
55 * Create the update-thread; this will not do anything until Start() is called.
56 * @param[in] sync An object used to synchronize update & render threads.
57 * @param[in] adaptorInterfaces base adaptor interface
58 * @param[in] environmentOptions environment options
60 UpdateThread(ThreadSynchronization& sync,
61 AdaptorInternalServices& adaptorInterfaces,
62 const EnvironmentOptions& environmentOptions );
65 * Non-virtual destructor; UpdateThread is not suitable as a base class.
70 * Starts the update-thread
75 * Stops the update-thread
82 * This method is used by the update-thread for calling Core::Update().
83 * @return true, if the thread finishes properly.
88 * Helper for the thread calling the entry function
89 * @param[in] This A pointer to the current UpdateThread object
91 static inline void* InternalThreadEntryFunc( void* This )
93 ( static_cast<UpdateThread*>( This ) )->Run();
99 ThreadSynchronization& mThreadSynchronization; ///< Used to synchronize all the threads
101 Dali::Integration::Core& mCore; ///< Dali core reference
103 FpsTracker mFpsTracker; ///< Object that tracks the FPS
104 UpdateStatusLogger mUpdateStatusLogger; ///< Object that logs the update-status as required.
106 pthread_t* mThread; ///< The actual update-thread.
107 const EnvironmentOptions& mEnvironmentOptions; ///< environment options
108 }; // class UpdateThread
110 } // namespace Adaptor
112 } // namespace Internal
116 #endif // __DALI_INTERNAL_UPDATE_THREAD_H__