sl@0: // Copyright (c) 1994-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: // e32test\prime\t_sem.cpp sl@0: // Overview: sl@0: // Test the RSemaphore type. sl@0: // API Information: sl@0: // RSemaphore sl@0: // Details: sl@0: // - Create two local semaphores, create a new thread, signal and wait on sl@0: // the semaphores numerous time. Kill the thread and verify results. sl@0: // - Test creating a local semaphore with an initial count of -1. Verify sl@0: // failure results are as expected. sl@0: // - Attempt to signal a semaphore without having done a create. Verify sl@0: // failure results are as expected. sl@0: // - Attempt to signal a semaphore with signal count of -1. Verify failure sl@0: // results are as expected. sl@0: // Platforms/Drives/Compatibility: sl@0: // All. sl@0: // Assumptions/Requirement/Pre-requisites: sl@0: // Failures and causes: sl@0: // Base Port information: sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: const TInt KMaxIterations=0x100; sl@0: const TInt KHeapSize=0x2000; sl@0: sl@0: LOCAL_D RTest test(_L("T_SEM")); sl@0: LOCAL_D RSemaphore consumer; sl@0: LOCAL_D RSemaphore producer; sl@0: sl@0: LOCAL_C TInt producerThreadEntryPoint(TAny* anArg) sl@0: // sl@0: // The entry point for the producer thread. sl@0: // sl@0: { sl@0: sl@0: anArg=anArg; sl@0: for (TInt i=0;i