|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\euser\epoc\up_dll_tls.cpp |
|
15 // This file contains DLL stub functions relating to TLS |
|
16 // |
|
17 // |
|
18 |
|
19 #include "up_std.h" |
|
20 #include <e32svr.h> |
|
21 #include "u32std.h" |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 /** |
|
27 Sets the value of the Thread Local Storage (TLS) variable. |
|
28 |
|
29 @param aPtr The value to be assigned to the Thread Local Storage variable. |
|
30 In practice, this is almost always a pointer to memory |
|
31 that has previously been allocated, but does not necessarily |
|
32 need to be so. |
|
33 |
|
34 @return KErrNone, if successful, otherwise one of the other |
|
35 system-wide error codes. |
|
36 */ |
|
37 TInt Dll::SetTls(TAny* aPtr) |
|
38 { |
|
39 #ifdef __EPOC32__ |
|
40 return UserSvr::DllSetTls(MODULE_HANDLE, *(((TInt*)MODULE_HANDLE)+3), aPtr); |
|
41 #else |
|
42 return UserSvr::DllSetTls(MODULE_HANDLE, KDllUid_Special, aPtr); |
|
43 #endif |
|
44 } |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 /** |
|
50 Gets the value of the Thread Local Storage (TLS) variable. |
|
51 |
|
52 @return The value of the Thread Local Storage variable as set by |
|
53 a previous call to Dll::SetTls(). If no value has previously |
|
54 been set, then the returned value is NULL. |
|
55 */ |
|
56 TAny* Dll::Tls() |
|
57 { |
|
58 #ifdef __EPOC32__ |
|
59 return UserSvr::DllTls(MODULE_HANDLE, *(((TInt*)MODULE_HANDLE)+3)); |
|
60 #else |
|
61 return UserSvr::DllTls(MODULE_HANDLE, KDllUid_Special); |
|
62 #endif |
|
63 } |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 /** |
|
69 Removes the Thread Local Storage (TLS) variable. |
|
70 |
|
71 A subsequent call to Dll::Tls() will return NULL. |
|
72 */ |
|
73 void Dll::FreeTls() |
|
74 { |
|
75 |
|
76 UserSvr::DllFreeTls(MODULE_HANDLE); |
|
77 } |