sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\euser\epoc\up_dll_tls.cpp sl@0: // This file contains DLL stub functions relating to TLS sl@0: // sl@0: // sl@0: sl@0: #include "up_std.h" sl@0: #include sl@0: #include "u32std.h" sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Sets the value of the Thread Local Storage (TLS) variable. sl@0: sl@0: @param aPtr The value to be assigned to the Thread Local Storage variable. sl@0: In practice, this is almost always a pointer to memory sl@0: that has previously been allocated, but does not necessarily sl@0: need to be so. sl@0: sl@0: @return KErrNone, if successful, otherwise one of the other sl@0: system-wide error codes. sl@0: */ sl@0: TInt Dll::SetTls(TAny* aPtr) sl@0: { sl@0: #ifdef __EPOC32__ sl@0: return UserSvr::DllSetTls(MODULE_HANDLE, *(((TInt*)MODULE_HANDLE)+3), aPtr); sl@0: #else sl@0: return UserSvr::DllSetTls(MODULE_HANDLE, KDllUid_Special, aPtr); sl@0: #endif sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the value of the Thread Local Storage (TLS) variable. sl@0: sl@0: @return The value of the Thread Local Storage variable as set by sl@0: a previous call to Dll::SetTls(). If no value has previously sl@0: been set, then the returned value is NULL. sl@0: */ sl@0: TAny* Dll::Tls() sl@0: { sl@0: #ifdef __EPOC32__ sl@0: return UserSvr::DllTls(MODULE_HANDLE, *(((TInt*)MODULE_HANDLE)+3)); sl@0: #else sl@0: return UserSvr::DllTls(MODULE_HANDLE, KDllUid_Special); sl@0: #endif sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Removes the Thread Local Storage (TLS) variable. sl@0: sl@0: A subsequent call to Dll::Tls() will return NULL. sl@0: */ sl@0: void Dll::FreeTls() sl@0: { sl@0: sl@0: UserSvr::DllFreeTls(MODULE_HANDLE); sl@0: }