Dali 3D User Interface Engine
thread-local-storage.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 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 // CLASS HEADER
20 
21 // INTERNAL INCLUDES
24 
25 namespace Dali
26 {
27 
28 namespace Internal
29 {
30 
31 namespace
32 {
33 #if defined(EMSCRIPTEN)
35 #else
36 __thread ThreadLocalStorage* threadLocal = NULL;
37 #endif
38 }
39 
41 : mCore( core )
42 {
43  DALI_ASSERT_ALWAYS( threadLocal == NULL && "Cannot create more than one ThreadLocalStorage object" );
44 
45  threadLocal = this;
46 }
47 
49 {
50 }
51 
53 {
54  threadLocal = NULL;
55 }
56 
58 {
60 
61  return *threadLocal;
62 }
63 
65 {
66  // see if the TLS has been set yet
67  return (threadLocal != NULL);
68 }
69 
71 {
72  return threadLocal;
73 }
74 
76 {
77  return mCore->GetPlatform();
78 }
79 
81 {
82  return mCore->GetUpdateManager();
83 }
84 
86 {
87  return mCore->GetNotificationManager();
88 }
89 
91 {
92  return mCore->GetResourceManager();
93 }
94 
96 {
97  return mCore->GetResourceClient();
98 }
99 
101 {
102  return mCore->GetImageFactory();
103 }
104 
106 {
107  return mCore->GetShaderFactory();
108 }
109 
111 {
112  return mCore->GetCurrentStage();
113 }
114 
116 {
117  return mCore->GetGestureEventProcessor();
118 }
119 
121 {
122  return mCore->GetRelayoutController();
123 }
124 
125 } // namespace Internal
126 
127 } // namespace Dali
Dali Docs Home
Read more about Dali