diff -r 000000000000 -r a41df078684a kerneltest/e32test/prime/t_sem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/prime/t_sem.cpp Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,190 @@ +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\prime\t_sem.cpp +// Overview: +// Test the RSemaphore type. +// API Information: +// RSemaphore +// Details: +// - Create two local semaphores, create a new thread, signal and wait on +// the semaphores numerous time. Kill the thread and verify results. +// - Test creating a local semaphore with an initial count of -1. Verify +// failure results are as expected. +// - Attempt to signal a semaphore without having done a create. Verify +// failure results are as expected. +// - Attempt to signal a semaphore with signal count of -1. Verify failure +// results are as expected. +// Platforms/Drives/Compatibility: +// All. +// Assumptions/Requirement/Pre-requisites: +// Failures and causes: +// Base Port information: +// +// + +#include +#include + +const TInt KMaxIterations=0x100; +const TInt KHeapSize=0x2000; + +LOCAL_D RTest test(_L("T_SEM")); +LOCAL_D RSemaphore consumer; +LOCAL_D RSemaphore producer; + +LOCAL_C TInt producerThreadEntryPoint(TAny* anArg) +// +// The entry point for the producer thread. +// + { + + anArg=anArg; + for (TInt i=0;i