diff -r bd31df28e32a -r 8adc5406f7cb Win32OperatingSystem.st --- a/Win32OperatingSystem.st Tue Aug 03 16:37:31 2010 +0200 +++ b/Win32OperatingSystem.st Tue Aug 03 17:08:47 2010 +0200 @@ -7055,7 +7055,8 @@ self primGetLastError. handle := self primCreateMutex:nil initialOwner: true name: name. lastErrorCode := self primGetLastError. - lastErrorCode printCR. + "/ lastErrorCode printCR. + "/ self assert: lastErrorCode == 0. "/ lastErrorCode == 5 "ERROR_ACCESS_DENIED" ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.]. "/ lastErrorCode == 183 "ERROR_ALREADY_EXISTS" ifTrue:[Transcript showCR: 'Mutex already exists (GetLastError = ERROR_ALREADY_EXISTS)'.]. @@ -7070,11 +7071,10 @@ self releaseMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0' " - "Modified: / 03-08-2010 / 16:30:37 / cg" + "Modified: / 03-08-2010 / 16:57:36 / cg" ! existsMutexNamed: name - |handle lastErrorCode handleAndLastErrorCode| handleAndLastErrorCode := self createMutexNamed: name. @@ -7082,17 +7082,16 @@ lastErrorCode := handleAndLastErrorCode second. "/ self assert: lastErrorCode == 0. ^ handle isNil - or:[lastErrorCode == 183 "ERROR_ALREADY_EXISTS" - or:[ lastErrorCode == 5 "ERROR_ACCESS_DENIED"]] + or:[lastErrorCode == 183 "ERROR_ALREADY_EXISTS" + or:[ lastErrorCode == 5 "ERROR_ACCESS_DENIED"]] + + "Modified: / 03-08-2010 / 16:59:41 / cg" ! openMutexNamed: name - - " - If the function succeeds, the return value is a handle to the mutex object. - If the function fails, the return value is NULL. To get extended error information, call GetLastError. - If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND. - " + "If the function succeeds, the return value is a handle to the mutex object. + If the function fails, the return value is NULL. To get extended error information, call GetLastError. + If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND." |handle | @@ -7101,8 +7100,8 @@ "/ lastErrorCode = 2 ifTrue:[Transcript showCR: 'Mutex does not exist (GetLastError = ERROR_FILE_NOT_FOUND)'.]. "/ lastErrorCode = 5 ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.]. (handle isNil or:[handle address ~~ 0]) ifFalse:[ - Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'. - ^ nil. + Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'. + ^ nil. ]. ^ handle @@ -7111,84 +7110,86 @@ " self openMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0' " + + "Modified: / 03-08-2010 / 16:59:37 / cg" ! primCreateMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName - - " - If the function succeeds, the return value is a handle to the newly created mutex object. + "If the function succeeds, the return value is a handle to the newly created mutex object. If the function fails, the return value is NULL. - If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object. - " + If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object." + + "Modified: / 03-08-2010 / 16:59:26 / cg" ! primOpenMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName - - " - If the function succeeds, the return value is a handle to the mutex object. - If the function fails, the return value is NULL. To get extended error information, call GetLastError. - If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND. - " + "If the function succeeds, the return value is a handle to the mutex object. + If the function fails, the return value is NULL. To get extended error information, call GetLastError. + If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND." + + "Modified: / 03-08-2010 / 16:59:11 / cg" ! primReleaseMutex: hMutex - - " - If the function succeeds, the return value is nonzero. - If the function fails, the return value is zero. - " + "If the function succeeds, the return value is nonzero. + If the function fails, the return value is zero." + + "Modified: / 03-08-2010 / 16:59:55 / cg" ! primWaitForSingleObject: handle milliseconds: dwMilliseconds - - " - If the function succeeds, the return value indicates the event that caused the function to return. - If the function fails, the return value is WAIT_FAILED ((DWORD)0xFFFFFFFF). - " + "If the function succeeds, the return value indicates the event that caused the function to return. + If the function fails, the return value is WAIT_FAILED ((DWORD)0xFFFFFFFF)." + + "Modified: / 03-08-2010 / 17:00:02 / cg" ! releaseMutex: hMutex - "Returns true if the Mutex was released. Otherwise, returns false." | released| hMutex isNil ifTrue:[ - Transcript showCR: 'hMutex is nil - cannot release'. - ^ false + Transcript showCR: 'hMutex is nil - cannot release'. + ^ false ]. released := self primReleaseMutex: hMutex. released ifFalse:[Transcript showCR: 'Release Mutex failed'.]. ^ released + + "Modified: / 03-08-2010 / 17:00:05 / cg" ! releaseMutexNamed: name - "Returns true if the Mutex was released. Otherwise, returns false." | hMutex | + hMutex := self openMutexNamed: name. hMutex isNil ifTrue:[ - Transcript showCR: 'Cannot release Mutex named: "', name printString,'"'. - ^ false + Transcript showCR: 'Cannot release Mutex named: "', name printString,'"'. + ^ false ]. ^ self releaseMutex: hMutex. + + "Modified: / 03-08-2010 / 16:58:25 / cg" ! waitForSingleObject: handle - |result| result := self primWaitForSingleObject: handle milliseconds: 500. ^ result + + "Modified: / 03-08-2010 / 17:00:10 / cg" ! ! !Win32OperatingSystem class methodsFor:'os queries'! @@ -16239,11 +16240,11 @@ !Win32OperatingSystem class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.408 2010-08-03 14:37:31 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.409 2010-08-03 15:08:47 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.408 2010-08-03 14:37:31 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.409 2010-08-03 15:08:47 cg Exp $' ! ! Win32OperatingSystem initialize!