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);
75 static _ThreadImpl* GetMainThreadImpl(void);
77 virtual result Initialize(void);
79 virtual result Finalize(void);
81 const Thread* GetThread(void) const;
83 ThreadPriority GetPriority(void) const;
85 void SetThread(Thread* pThread);
87 void SetNativeThread(pthread_t nativeThread);
88 void SetMainThread(void);
91 static void* ThreadProc(void* pParam);
99 ThreadPriority __priority;
100 ThreadType __threadType;
101 pthread_t __nativeThread;
103 _EventManager* __pEventManager;
104 static Thread* __pDefaultThread;
107 } } } // Tizen::Base::Runtime
109 #endif // _FBASE_RT_INTERNAL_THREAD_IMPL_H_