sl@0: // Copyright (c) 2010 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 "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: // sl@0: sl@0: #include sl@0: #include sl@0: #include "tgraphicsresourcemultiprocessthread.h" sl@0: sl@0: // The second process waits for image IDs sent by the main test process sl@0: // and opens and closes RSgImage handles to the corresponding images. sl@0: // Image IDs are received through a message queue and synchronisation sl@0: // with the main process is achieved by means of rendezvous objects. sl@0: // A null ID indicates the end of the test. sl@0: void MainL() sl@0: { sl@0: RSgDriver driver; sl@0: User::LeaveIfError(driver.Open()); sl@0: CleanupClosePushL(driver); sl@0: RMsgQueue msgQ; sl@0: User::LeaveIfError(msgQ.OpenGlobal(KSgTestMultiprocessMsgQ)); sl@0: CleanupClosePushL(msgQ); sl@0: for (;;) sl@0: { sl@0: TSgDrawableId id; sl@0: msgQ.ReceiveBlocking(id); sl@0: if (id == KSgNullDrawableId) sl@0: { sl@0: break; sl@0: } sl@0: RSgImage image; sl@0: TInt err = image.Open(id); sl@0: image.Close(); sl@0: RProcess::Rendezvous(err); sl@0: } sl@0: CleanupStack::PopAndDestroy(2); sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: if (!cleanup) sl@0: { sl@0: return KErrNoMemory; sl@0: } sl@0: TRAPD(ret, MainL()); sl@0: delete cleanup; sl@0: __UHEAP_MARKEND; sl@0: return ret; sl@0: }