public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 4/8] [gdb/dap] Make dap log printing thread-safe
Date: Wed, 21 Feb 2024 14:31:12 +0100	[thread overview]
Message-ID: <92d73bc7-1c1a-4ae2-a2c6-ed956418f28c@suse.de> (raw)
In-Reply-To: <87edd72lu4.fsf@tromey.com>

On 2/20/24 16:32, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> 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 <tom@tromey.com>
> 
> 
> 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.

Dropped that bit, and committed.

Thanks,
- Tom


  reply	other threads:[~2024-02-21 13:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19  8:23 [PATCH 1/8] [gdb/testsuite] Set up dap log file in gdb.dap/type_checker.exp Tom de Vries
2024-02-19  8:23 ` [PATCH 2/8] [gdb/dap] Factor out thread_log Tom de Vries
2024-02-20 15:30   ` Tom Tromey
2024-02-21 13:30     ` Tom de Vries
2024-02-19  8:23 ` [PATCH 3/8] [gdb/dap] Flush after printing in log_stack Tom de Vries
2024-02-20 15:30   ` Tom Tromey
2024-02-19  8:23 ` [PATCH 4/8] [gdb/dap] Make dap log printing thread-safe Tom de Vries
2024-02-20 15:32   ` Tom Tromey
2024-02-21 13:31     ` Tom de Vries [this message]
2024-02-19  8:23 ` [PATCH 5/8] [gdb/dap] Fix race between dap startup and dap log file Tom de Vries
2024-02-20 15:38   ` Tom Tromey
2024-02-19  8:23 ` [PATCH 6/8] [gdb/dap] Don't let dap log string grow indefinitely Tom de Vries
2024-02-20 15:41   ` Tom Tromey
2024-02-21 13:34     ` Tom de Vries
2024-02-19  8:23 ` [PATCH 7/8] [gdb/dap] Join JSON reader and writer threads with DAP thread Tom de Vries
2024-02-20 15:47   ` Tom Tromey
2024-02-20 20:01   ` Tom Tromey
2024-02-21 13:35     ` Tom de Vries
2024-02-19  8:23 ` [PATCH 8/8] [gdb/dap] Fix race between dap exit and gdb exit Tom de Vries
2024-02-20 15:51   ` Tom Tromey
2024-02-21 13:39     ` Tom de Vries
2024-02-20 15:29 ` [PATCH 1/8] [gdb/testsuite] Set up dap log file in gdb.dap/type_checker.exp Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92d73bc7-1c1a-4ae2-a2c6-ed956418f28c@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).