[ros-diffs] [hbirr] 16901: If a mutex already exist,
open it instead of create.
hbirr at svn.reactos.com
hbirr at svn.reactos.com
Sat Jul 30 21:03:38 CEST 2005
If a mutex already exist, open it instead of create.
Modified: trunk/reactos/lib/kernel32/synch/mutex.c
_____
Modified: trunk/reactos/lib/kernel32/synch/mutex.c
--- trunk/reactos/lib/kernel32/synch/mutex.c 2005-07-30 19:00:33 UTC
(rev 16900)
+++ trunk/reactos/lib/kernel32/synch/mutex.c 2005-07-30 19:03:34 UTC
(rev 16901)
@@ -92,10 +92,24 @@
MUTEX_ALL_ACCESS,
&ObjectAttributes,
(BOOLEAN)bInitialOwner);
+ if (Status == STATUS_OBJECT_NAME_COLLISION)
+ {
+ Status = NtOpenMutant(&MutantHandle,
+ MUTEX_ALL_ACCESS,
+ &ObjectAttributes);
+ if (NT_SUCCESS(Status))
+ {
+ if(bInitialOwner)
+ {
+ WaitForSingleObject(MutantHandle, INFINITE);
+ }
+ SetLastError(ERROR_ALREADY_EXISTS);
+ }
+ }
if (!NT_SUCCESS(Status))
{
- SetLastErrorByStatus(Status);
- return NULL;
+ SetLastErrorByStatus(Status);
+ return NULL;
}
return MutantHandle;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050730/8c8d396d/attachment.html
More information about the Ros-diffs
mailing list