glib/libgmodule/src/gmodule_wsd.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32std.h>
       
    21 #include <_ansi.h>
       
    22 #include <glib.h>
       
    23 #include "gmodule_wsd.h"
       
    24 #include <stdlib.h>
       
    25 #include <gthread.h>
       
    26 
       
    27 #if EMULATOR
       
    28 
       
    29 #include <pls.h> // For emulator WSD API 
       
    30 const TUid KLibgmoduleUid3 = {0x10281F3B};     // This is the UID of the library
       
    31 
       
    32 G_BEGIN_DECLS
       
    33 
       
    34 int InitializeWsd(struct global_struct* g)
       
    35 {
       
    36 	memset(g,0,sizeof(struct global_struct));
       
    37 	
       
    38 	GStaticRecMutex temp_init_mutex = G_STATIC_REC_MUTEX_INIT;
       
    39 	memcpy(&(g->VARIABLE_NAME(g_module_global_lock, gmodule)), &temp_init_mutex, sizeof(GStaticMutex));
       
    40 	return KErrNone;
       
    41 }
       
    42 
       
    43 struct global_struct *Gmodule_ImpurePtr()
       
    44 {
       
    45 #if defined(__WINSCW__) || defined(__WINS__)
       
    46 
       
    47 	// Access the PLS of this process
       
    48 	struct global_struct* p  = Pls<struct global_struct>(KLibgmoduleUid3, &InitializeWsd);
       
    49     return p;
       
    50     
       
    51 #else
       
    52 	
       
    53 	return NULL;
       
    54 
       
    55 #endif
       
    56 
       
    57 }
       
    58 
       
    59 
       
    60 G_END_DECLS
       
    61 #endif /* EMULATOR */ 
       
    62