2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FBaseRt_ThreadImpl.h
19 * @brief This is the header file for the %_ThreadImpl class.
21 * This file contains the declarations of the %_ThreadImpl class.
24 #ifndef _FBASE_RT_INTERNAL_THREAD_IMPL_H_
25 #define _FBASE_RT_INTERNAL_THREAD_IMPL_H_
29 #include <FBaseRtThread.h>
30 #include "FBaseRt_EventManager.h"
32 namespace Tizen { namespace Base { namespace Runtime
35 class _OSP_EXPORT_ _ThreadImpl
36 : public Tizen::Base::Object
37 , public Tizen::Base::Runtime::IRunnable
40 _ThreadImpl(Thread& thread, const Tizen::Base::String& name, long stackSize
41 , ThreadPriority priority, ThreadType threadType);
43 virtual ~_ThreadImpl(void);
45 virtual result Start(void);
47 virtual result Stop(void);
49 virtual result SendUserEvent(RequestId requestId, const Tizen::Base::Collection::IList* pArgs);
53 result GetExitCode(int& exitCode) const;
55 const Tizen::Base::String& GetName(void) const;
57 ThreadType GetThreadType(void) const;
59 void SetEventManager(_EventManager* pEventManager);
61 _EventManager* GetEventManager(void);
63 virtual Tizen::Base::Object* Run(void);
65 static void Exit(int exitCode);
67 static result Sleep(long milliSeconds);
69 static result Yield(void);
71 static Thread* GetCurrentThread(void);
73 static _ThreadImpl* GetCurrentThreadImpl(void);
76 virtual result Initialize(void);
78 virtual result Finalize(void);
80 const Thread* GetThread(void) const;
82 const ThreadPriority GetPriority(void) const;
84 void SetThread(Thread* pThread);
86 void SetNativeThread(pthread_t nativeThread);
89 static void* ThreadProc(void* pParam);
97 ThreadPriority __priority;
98 ThreadType __threadType;
99 pthread_t __nativeThread;
101 _EventManager* __pEventManager;
104 } } } // Tizen::Base::Runtime
106 #endif // _FBASE_RT_INTERNAL_THREAD_IMPL_H_