Merge "Fix build depen." into tizen_2.2
[platform/framework/native/appfw.git] / src / base / runtime / FBaseRt_ThreadManager.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file        FBaseRt_ThreadManager.cpp
19  * @brief       This is the implementation file for the _ThreadManager class.
20  *
21  */
22
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <new>
26
27 #include <FBaseRtThread.h>
28
29 #include <FBaseSysLog.h>
30 #include "FBaseRt_ThreadManager.h"
31 #include "FBaseRt_ThreadImpl.h"
32
33
34 namespace Tizen { namespace Base { namespace Runtime
35 {
36
37 Thread* _ThreadManager::__pMainThread = null;
38
39 result
40 _ThreadManager::Initialize(void)
41 {
42         __pMainThread = new (std::nothrow) Thread;
43         SysTryLog(NID_BASE_RT, __pMainThread != null, "[E_OUT_OF_MEMORY] Unable to create Thread object");
44
45         result r = __pMainThread->Construct(L"MainThread", THREAD_TYPE_MAIN);
46         SysTryLog(NID_BASE_RT, !IsFailed(r), "[%s] Propagating.", GetErrorMessage(r));
47
48         __pMainThread->Start();
49
50         return E_SUCCESS;
51 }
52
53 result
54 _ThreadManager::Finalize(void)
55 {
56         delete __pMainThread;
57         __pMainThread = null;
58         return E_SUCCESS;
59 }
60
61 _ThreadManager::_ThreadManager(void)
62 {
63 }
64
65 _ThreadManager::~_ThreadManager(void)
66 {
67 }
68
69 } } } //Tizen::Base::Runtime