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