2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FBaseRt_ThreadImpl.h
20 * @brief This is the header file for the %_ThreadImpl class.
22 * This file contains the declarations of the %_ThreadImpl class.
25 #ifndef _FBASE_RT_INTERNAL_THREAD_IMPL_H_
26 #define _FBASE_RT_INTERNAL_THREAD_IMPL_H_
30 #include <FBaseRtThread.h>
31 #include "FBaseRt_EventManager.h"
33 namespace Tizen { namespace Base { namespace Runtime
36 class _OSP_EXPORT_ _ThreadImpl
37 : public Tizen::Base::Object
38 , public Tizen::Base::Runtime::IRunnable
41 _ThreadImpl(Thread& thread, const Tizen::Base::String& name, long stackSize
42 , ThreadPriority priority, ThreadType threadType);
44 virtual ~_ThreadImpl(void);
46 virtual result Start(void);
48 virtual result Stop(void);
50 virtual result SendUserEvent(RequestId requestId, const Tizen::Base::Collection::IList* pArgs);
54 result GetExitCode(int& exitCode) const;
56 const Tizen::Base::String& GetName(void) const;
58 ThreadType GetThreadType(void) const;
60 void SetEventManager(_EventManager* pEventManager);
62 _EventManager* GetEventManager(void);
64 virtual Tizen::Base::Object* Run(void);
66 static void Exit(int exitCode);
68 static result Sleep(long milliSeconds);
70 static result Yield(void);
72 static Thread* GetCurrentThread(void);
74 static _ThreadImpl* GetCurrentThreadImpl(void);
77 virtual result Initialize(void);
79 virtual result Finalize(void);
81 const Thread* GetThread(void) const;
83 const ThreadPriority GetPriority(void) const;
85 void SetThread(Thread* pThread);
87 void SetNativeThread(pthread_t nativeThread);
90 static void* ThreadProc(void* pParam);
98 ThreadPriority __priority;
99 ThreadType __threadType;
100 pthread_t __nativeThread;
102 _EventManager* __pEventManager;
105 } } } // Tizen::Base::Runtime
107 #endif // _FBASE_RT_INTERNAL_THREAD_IMPL_H_