From: Thomas Bluemel Date: Fri, 8 Oct 2004 21:48:46 +0000 (+0000) Subject: atomically increment the pipe id to be thread-safe. Thanks to Mark Grosberg for repor... X-Git-Tag: backups/new_headers@15094~37^2~176 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=6961ff97284d2b0b6f6a58bed1a96cfa985767b7 atomically increment the pipe id to be thread-safe. Thanks to Mark Grosberg for reporting it. svn path=/trunk/; revision=11240 --- diff --git a/reactos/lib/kernel32/file/pipe.c b/reactos/lib/kernel32/file/pipe.c index 9008fe63b4b..a8858174db1 100644 --- a/reactos/lib/kernel32/file/pipe.c +++ b/reactos/lib/kernel32/file/pipe.c @@ -1,4 +1,4 @@ -/* $Id: pipe.c,v 1.10 2004/01/23 21:16:03 ekohl Exp $ +/* $Id: pipe.c,v 1.11 2004/10/08 21:48:46 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -37,15 +37,16 @@ BOOL STDCALL CreatePipe(PHANDLE hReadPipe, NTSTATUS Status; HANDLE ReadPipeHandle; HANDLE WritePipeHandle; + ULONG PipeId; PSECURITY_DESCRIPTOR SecurityDescriptor = NULL; DefaultTimeout.QuadPart = 300000000; /* 30 seconds */ - ProcessPipeId++; + PipeId = (ULONG)InterlockedIncrement((LONG*)&ProcessPipeId); swprintf(Buffer, L"\\Device\\NamedPipe\\Win32Pipes.%08x.%08x", NtCurrentTeb()->Cid.UniqueProcess, - ProcessPipeId); + PipeId); RtlInitUnicodeString (&PipeName, Buffer);