|
From: Hans D. <dul...@us...> - 2000-11-15 22:54:45
|
Update of /cvsroot/corelinux/corelinux/src/testdrivers/ex22 In directory slayer.i.sourceforge.net:/tmp/cvs-serv21303 Modified Files: examp22.cpp Log Message: Modified both listener and owner to run in a loop. Index: examp22.cpp =================================================================== RCS file: /cvsroot/corelinux/corelinux/src/testdrivers/ex22/examp22.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** examp22.cpp 2000/09/18 10:58:36 1.3 --- examp22.cpp 2000/11/15 22:54:42 1.4 *************** *** 153,160 **** // ! cout << "Release event semaphore" << endl; ! aEventSem->release(); ! sleep(2); cout << "Cleaning up" << endl; --- 153,165 ---- // ! while (1) ! { ! ! cout << "Release event semaphore" << endl; ! aEventSem->release(); ! sleep(2); ! aEventSem->post(); ! } cout << "Cleaning up" << endl; *************** *** 229,238 **** aGroupPtr->createSemaphore( gSemId, FAIL_IF_NOTEXISTS ) ); - - - aEventSem->lockWithWait(); - - cout << "Semaphore obtained" << endl; aGroupPtr->destroySemaphore( aEventSem ); aEventSem = NULLPTR; --- 234,244 ---- aGroupPtr->createSemaphore( gSemId, FAIL_IF_NOTEXISTS ) ); + while (1) + { + rc = aEventSem->lockWithWait(); + if ( rc == SUCCESS ) + cout << "Semaphore obtained" << endl; + } aGroupPtr->destroySemaphore( aEventSem ); aEventSem = NULLPTR; |