"{ Package: 'exept:regression' }"
"{ NameSpace: RegressionTests }"
TestCase subclass:#Win32OperatingSystemTest
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'tests-Regression'
!
!Win32OperatingSystemTest methodsFor:'release'!
tearDown
! !
!Win32OperatingSystemTest methodsFor:'tests'!
testMutex
|handle alreadyExists lastErrorCode handleAndLastErrorCode|
handleAndLastErrorCode := Win32OperatingSystem createMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'.
handle := handleAndLastErrorCode first.
handle isNil ifTrue:[^ self].
lastErrorCode := handleAndLastErrorCode second.
self assert: lastErrorCode == 0.
alreadyExists := (lastErrorCode == 5 "ERROR_ACCESS_DENIED" or:[ lastErrorCode == 183 "ERROR_ALREADY_EXISTS"]).
alreadyExists ifTrue:[
Transcript showCR: 'Mutex already exists!!'.
^ self.
].
Transcript showCR: 'Mutex created!!'.
Win32OperatingSystem waitForSingleObject: handle.
self halt.
Win32OperatingSystem releaseMutex: handle.
Win32OperatingSystem primCloseHandle: handle.
Transcript showCR: 'Mutex closed!!'.
"
self new testMutex
"
! !
!Win32OperatingSystemTest class methodsFor:'documentation'!
version
^ '$Header$'
! !