Hello Przemek Next applicantion instance is put under indefinite loop in dbUseArea() if a table is attempted to be opened in EXCLUSIVE mode where first instance has alreay that table open in SHARED mode. Appln is compiled with MT support.
Here is the code from my appln ( working since good old Clipper days ) function Sema4Init() local fname := if( SetCache(), SEMA4FILE , SEMA4PATH+'\'+SEMA4FILE ) local iName := if( SetCache(), SEMA4INDEX, SEMA4PATH+'\'+SEMA4INDEX ) if !VouExistTable( SEMA4ALIAS, SEMA4FILE, SEMA4PATH, cSemaDrv, .f. ) bDbCreate( fName,{ { 'sema4name','C',20,0 },{ 'username','C',5,0 } }, cSemaDrv ) if !VouExistTable( SEMA4ALIAS, SEMA4FILE, SEMA4PATH, cSemaDrv,.f. ) alert( 'SemaPhore file could not be created' ) return .f. endif endif // check if anybody is logged with exclusive use // // ///////////// NEXT INSTANCE HANGS HERE ( CPU USAGE 50% FOR THIS INSTANCE ) //////// // if eval( {|| dbUseArea( .t.,cSemaDrv,fName,SEMA4ALIAS,.f. ), !NetErr() } ) // other code DbCloseArea() endif // compulsory use sema4 in shared mode do while .t. if eval( {|| dbusearea(.t.,cSemaDrv,fName,SEMA4ALIAS,.T.),!netErr()} ) if !VouExistIndex( SEMA4ALIAS, SEMA4INDEX, SEMA4PATH, cSemaDrv, .f. ) dbclosearea() return .f. endif ordlistclear() ordlistadd( iName ) ordsetfocus( 1 ) else return .f. endif exit enddo do while !dbRelease( SEMA4ALIAS ) //////////////// NOTE, may be important //////////// enddo return .t. //----------------------------------------------------------------------// Regards Pritpal Bedi -- View this message in context: http://www.nabble.com/MT---DBFCDX---Next-Appln-Instance-Hangs-...-tp23352456p23352456.html Sent from the Harbour - Dev mailing list archive at Nabble.com. _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour