[squid-dev] [PATCH] Make PID file check/creation atomic

Eduard Bagdasaryan eduard.bagdasaryan at measurement-factory.com
Mon May 15 13:42:02 UTC 2017


Could you clarify, what are these processes that 'operate as threads'? 
AFAIK,
Squid spawns its children by fork() and execlp(), and each new process is a
common process with its own address space. As for atomicity, the OS itself
guarantees that only one process can have an exclusive file lock at a
given time. Where do you suggest to use std::atomic then?


Eduard.

On 15.05.2017 15:04, Amos Jeffries wrote:
> On 07/05/17 09:59, Eduard Bagdasaryan wrote:
>> This patch makes PID file check/creation atomic to avoid associated
>> race conditions.
>
> I do not see any use of atomic's in this patch. Please use std::atomic 
> locks to ensure actually atomic operations on the file locks. Squid 
> does have some child processes operating as threads so custom 
> implementations that don't use real atomic's will fail under some 
> circumstances.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20170515/e9a73d5a/attachment.html>


More information about the squid-dev mailing list