From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 37F4C3858D20 for ; Tue, 20 Feb 2024 15:32:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37F4C3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 37F4C3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708443127; cv=none; b=I0bZVz50lD74eZ+q3XOWpfBUanZqpKa0t88G4TqTzV1JQcaavdbWg7U/Cpz4TbS7dLHhGhzn/ouxPF2xbLAhGgyq+u0W+GnsKCZ5jZ4TzheSsbtzCKB/wvhbjnqB9Sg+CrWUUtdXENCjCK/zazoYCyxfFCZX6lPWxpkEQJO0rYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708443127; c=relaxed/simple; bh=mFL7+ggpzVcbfKmVWnnCA4yr8at4inj9xM887lpS3o0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=I5OFmUGlrF10czQ8v4cuHOkE4/HCiN0S+/dckmBAlq+ZyHd8xs+ZIaLu3s3CiaTPcGH5NW0BHiXs35beOZhrcn/LT/whL6gGDq02R160OtzMZ77jQp/EvrxU8ArQq03i/jmEl1EFC6U+XJ8bps8Vss1ggd9WiG4LywYA2Rd2YwQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id cKAqrV9n1rh9zcS6HrYWGd; Tue, 20 Feb 2024 15:32:05 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id cS6Grid66FgIvcS6GrlV30; Tue, 20 Feb 2024 15:32:05 +0000 X-Authority-Analysis: v=2.4 cv=ba3IU/PB c=1 sm=1 tr=0 ts=65d4c5f5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=k7vzHIieQBIA:10 a=Qbun_eYptAEA:10 a=zstS-IiYAAAA:8 a=dBGSGXWn2HO8JkZsYkgA:9 a=zZCYzV9kfG8A:10 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JVAcgHpiwnm9/1XR5VuylpVIUyqrKSGl+EtOH5M2L2M=; b=hNHF/J4W09/wwmpln3bpuVXDY8 L9pCtt52W3pchPXSmlmdLfU9EzYvYaK3wU41V2xEjUwtjk+LH8b8+ESldHU5hVYeCPSCRzZ1PJbws 2fSPjgDnL+MToKij5AlDPBDM+; Received: from 71-211-170-195.hlrn.qwest.net ([71.211.170.195]:36144 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rcS6G-003prE-0j; Tue, 20 Feb 2024 08:32:04 -0700 From: Tom Tromey To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 4/8] [gdb/dap] Make dap log printing thread-safe References: <20240219082341.21313-1-tdevries@suse.de> <20240219082341.21313-4-tdevries@suse.de> X-Attribution: Tom Date: Tue, 20 Feb 2024 08:32:03 -0700 In-Reply-To: <20240219082341.21313-4-tdevries@suse.de> (Tom de Vries's message of "Mon, 19 Feb 2024 09:23:37 +0100") Message-ID: <87edd72lu4.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.170.195 X-Source-L: No X-Exim-ID: 1rcS6G-003prE-0j X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-170-195.hlrn.qwest.net (murgatroyd) [71.211.170.195]:36144 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfPXS1HW2Eeht/4wp2aCK+T7r+RvMX5a50NA2fqO+/vjkadowNB8hekOqdD+KXgjiD/zla+e5eSntxwvqxTqVjh/wY+SqA5OpMnOdIpuX4KELBNqHD/eE Dwc7o9TKh9fgwN0q8R7aVzZl+qBfU2iBYIjyLS34XeWWnQQQmxR5iO9Nu76NocDTEFeE3g0WXKS5S8BFUce/q75dMARVUwfV2yM= X-Spam-Status: No, score=-3016.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Tom" == Tom de Vries writes: Tom> I read that printing from different python threads is thread-unsafe, and I Tom> noticed that the dap log printing is used from different threads, but doesn't Tom> take care to make the printing thread-safe. Tom> Fix this by using a lock to access LoggingParam.log_file. Ok. Approved-By: Tom Tromey I wonder if we should just switch to the Python logging module. Tom> - log_file = None Tom> + lock = threading.Lock() Tom> + with lock: Tom> + log_file = None I can't imagine locking is needed here. Tom