apicompatanamdw/bcdrivers/os/ossrv/glib/src/tthread.c
author shrivatsa
Thu, 22 Apr 2010 17:15:08 +0530
changeset 2 0cb2248d0edc
child 8 d8ef7a232001
permissions -rw-r--r--
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer, Startup List Management, Flash viewer framework, Network Status, Profile engine wrapper, Drm helper, OMA Drm CAF Agent, SIP, Connection settings & UI, BLID, Landmarks, Send UI, Media Fetch, WebServices, Cellular services, Device services, Graphics, Kernel and OSSrv, XML Services, Multimedia.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     1
/*
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     3
* All rights reserved.
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     4
* This component and the accompanying materials are made available
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     6
* which accompanies this distribution, and is available
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     8
*
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
     9
* Initial Contributors:
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    11
*
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    12
* Contributors:
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    13
*
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    14
* Description:
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    15
*
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    16
*/
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    17
#undef G_DISABLE_ASSERT
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    18
#undef G_LOG_DOMAIN
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    19
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    20
#include <glib.h>
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    21
#include <stdio.h>
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    22
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    23
#ifdef SYMBIAN
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    24
#include <glib_global.h>
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    25
#include "mrt2_glib2_test.h"
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    26
#endif /*SYMBIAN*/
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    27
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    28
#define THREADS 10
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    29
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    30
/* GStaticRecMutex */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    31
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    32
GStaticRecMutex test_g_static_rec_mutex_mutex;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    33
static guint test_g_static_rec_mutex_int = 0;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    34
static gboolean test_g_static_rec_mutex_thread_ready;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    35
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    36
static gpointer
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    37
test_g_static_rec_mutex_thread (gpointer data)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    38
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    39
  g_assert (GPOINTER_TO_INT (data) == 42);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    40
  g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex) 
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    41
	    == FALSE);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    42
  test_g_static_rec_mutex_thread_ready = TRUE;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    43
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    44
  //Testing g_static_rec_mutex_lock_full
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    45
  g_static_rec_mutex_lock_full (&test_g_static_rec_mutex_mutex, 10);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    46
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    47
  g_assert (test_g_static_rec_mutex_int == 42);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    48
  test_g_static_rec_mutex_thread_ready = FALSE;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    49
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    50
  //Testing g_static_rec_mutex_unlock_full for lock_full
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    51
  g_static_rec_mutex_unlock_full (&test_g_static_rec_mutex_mutex);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    52
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    53
  g_thread_exit (GINT_TO_POINTER (43));
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    54
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    55
  g_assert_not_reached ();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    56
  return NULL;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    57
}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    58
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    59
static void
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    60
test_g_static_rec_mutex (void)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    61
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    62
  GThread *thread;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    63
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    64
  //Test for g_static_rec_mutex_init	
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    65
  g_static_rec_mutex_init(&test_g_static_rec_mutex_mutex);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    66
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    67
  g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    68
  test_g_static_rec_mutex_thread_ready = FALSE;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    69
  thread = g_thread_create (test_g_static_rec_mutex_thread, 
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    70
			    GINT_TO_POINTER (42), TRUE, NULL);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    71
  /* This busy wait is only for testing purposes and not an example of
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    72
   * good code!*/
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    73
  while (!test_g_static_rec_mutex_thread_ready)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    74
    g_usleep (G_USEC_PER_SEC / 5);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    75
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    76
  g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    77
  test_g_static_rec_mutex_int = 41;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    78
  g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    79
  test_g_static_rec_mutex_int = 42;  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    80
  g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    81
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    82
  /* This busy wait is only for testing purposes and not an example of
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    83
   * good code!*/
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    84
  while (test_g_static_rec_mutex_thread_ready)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    85
    g_usleep (G_USEC_PER_SEC / 5);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    86
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    87
  g_static_rec_mutex_lock (&test_g_static_rec_mutex_mutex);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    88
  test_g_static_rec_mutex_int = 0;  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    89
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    90
  //Testing g_static_rec_mutex_unlock_full with normal single lock
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    91
  g_static_rec_mutex_unlock_full (&test_g_static_rec_mutex_mutex);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    92
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    93
  g_assert (GPOINTER_TO_INT (g_thread_join (thread)) == 43);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    94
  g_static_rec_mutex_free (&test_g_static_rec_mutex_mutex);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    95
}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    96
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    97
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    98
/* GStaticRWLock */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
    99
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   100
/* -1 = writing; >0 = # of readers */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   101
static gint test_g_static_rw_lock_state = 0; 
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   102
G_LOCK_DEFINE (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   103
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   104
static gboolean test_g_static_rw_lock_run = TRUE; 
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   105
GStaticRWLock test_g_static_rw_lock_lock;// = G_STATIC_RW_LOCK_INIT;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   106
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   107
static gpointer
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   108
test_g_static_rw_lock_thread (gpointer data)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   109
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   110
  while (test_g_static_rw_lock_run)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   111
    {
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   112
      if (g_random_double() > .2) /* I'm a reader */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   113
	{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   114
	  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   115
	  if (g_random_double() > .2) /* I'll block */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   116
	    g_static_rw_lock_reader_lock (&test_g_static_rw_lock_lock);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   117
	  else /* I'll only try */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   118
	    if (!g_static_rw_lock_reader_trylock (&test_g_static_rw_lock_lock))
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   119
	      continue;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   120
	  G_LOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   121
	  g_assert (test_g_static_rw_lock_state >= 0);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   122
	  test_g_static_rw_lock_state++;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   123
	  G_UNLOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   124
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   125
	  g_usleep (g_random_int_range (20,1000));
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   126
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   127
	  G_LOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   128
	  test_g_static_rw_lock_state--;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   129
	  G_UNLOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   130
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   131
	  g_static_rw_lock_reader_unlock (&test_g_static_rw_lock_lock);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   132
	}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   133
      else /* I'm a writer */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   134
	{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   135
	  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   136
	  if (g_random_double() > .2) /* I'll block */ 
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   137
	    g_static_rw_lock_writer_lock (&test_g_static_rw_lock_lock);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   138
	  else /* I'll only try */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   139
	    if (!g_static_rw_lock_writer_trylock (&test_g_static_rw_lock_lock))
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   140
	      continue;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   141
	  G_LOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   142
	  g_assert (test_g_static_rw_lock_state == 0);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   143
	  test_g_static_rw_lock_state = -1;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   144
	  G_UNLOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   145
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   146
	  g_usleep (g_random_int_range (20,1000));
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   147
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   148
	  G_LOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   149
	  test_g_static_rw_lock_state = 0;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   150
	  G_UNLOCK (test_g_static_rw_lock_state);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   151
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   152
	  g_static_rw_lock_writer_unlock (&test_g_static_rw_lock_lock);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   153
	}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   154
    }
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   155
  return NULL;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   156
}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   157
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   158
static void
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   159
test_g_static_rw_lock ()
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   160
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   161
  GThread *threads[THREADS];
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   162
  guint i;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   163
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   164
  g_static_rw_lock_init(&test_g_static_rw_lock_lock);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   165
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   166
  for (i = 0; i < THREADS; i++)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   167
    {
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   168
      threads[i] = g_thread_create (test_g_static_rw_lock_thread, 
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   169
				    NULL, TRUE, NULL);      
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   170
    }
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   171
  g_usleep (G_USEC_PER_SEC * 5);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   172
  test_g_static_rw_lock_run = FALSE;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   173
  for (i = 0; i < THREADS; i++)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   174
    {
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   175
      g_thread_join (threads[i]);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   176
    }
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   177
  g_assert (test_g_static_rw_lock_state == 0);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   178
  g_static_rw_lock_free(&test_g_static_rw_lock_lock);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   179
}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   180
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   181
void test_g_thread_error_quark()
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   182
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   183
	GQuark c = g_thread_error_quark();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   184
	g_assert(c == 1);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   185
}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   186
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   187
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   188
static void test_g_thread_set_priority (void)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   189
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   190
  GThread *thread;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   191
  thread = g_thread_self();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   192
  g_thread_set_priority (thread, G_THREAD_PRIORITY_HIGH);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   193
  g_assert((thread->priority) == G_THREAD_PRIORITY_HIGH);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   194
}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   195
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   196
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   197
/* run all the tests */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   198
void
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   199
run_all_thread_tests()
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   200
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   201
  test_g_static_rec_mutex ();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   202
  test_g_static_rw_lock ();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   203
  test_g_thread_error_quark();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   204
  test_g_thread_set_priority();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   205
}
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   206
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   207
int 
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   208
main (int   argc,
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   209
      char *argv[])
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   210
{
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   211
  #ifdef SYMBIAN
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   212
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   213
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   214
  g_set_print_handler(mrtPrintHandler);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   215
  #endif /*SYMBIAN*/
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   216
	  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   217
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   218
  /* Only run the test, if threads are enabled and a default thread
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   219
     implementation is available */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   220
#if defined(G_THREADS_ENABLED) && ! defined(G_THREADS_IMPL_NONE)
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   221
  g_thread_init (NULL);
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   222
  run_all_thread_tests ();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   223
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   224
  /* Now we rerun all tests, but this time we fool the system into
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   225
   * thinking, that the available thread system is not native, but
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   226
   * userprovided. */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   227
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   228
  g_thread_use_default_impl = FALSE;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   229
  run_all_thread_tests ();
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   230
  
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   231
#endif
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   232
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   233
#ifdef SYMBIAN
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   234
  testResultXml("tthread");
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   235
#endif /* EMULATOR */
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   236
  return 0;
0cb2248d0edc New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff changeset
   237
}