Linux NFS development
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: Alexander Zeijlon <alexander.zeijlon@cendio.se>
Cc: linux-nfs@vger.kernel.org, Calum Mackay <calum.mackay@oracle.com>
Subject: Re: [PATCH] Stop using deprecated thread.setDaemon
Date: Wed, 13 Sep 2023 11:13:34 -0400	[thread overview]
Message-ID: <20230913151334.GB3189@fieldses.org> (raw)
In-Reply-To: <20230913104636.2554987-1-alexander.zeijlon@cendio.se>

Adding Calum Mackay.--b.

On Wed, Sep 13, 2023 at 12:46:36PM +0200, Alexander Zeijlon wrote:
> The thread.setDaemon method is deprecated since Python version 3.10, the
> daemon property should now be set directly.
> 
> Signed-off-by: Alexander Zeijlon <alexander.zeijlon@cendio.se>
> ---
>  nfs4.0/nfs4lib.py                   | 2 +-
>  nfs4.0/servertests/st_delegation.py | 4 ++--
>  nfs4.1/nfs4state.py                 | 2 +-
>  rpc/rpc.py                          | 4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
> index 9b074f0..9a72ec9 100644
> --- a/nfs4.0/nfs4lib.py
> +++ b/nfs4.0/nfs4lib.py
> @@ -297,7 +297,7 @@ class NFS4Client(rpc.RPCClient):
>          # Start up callback server associated with this client
>          self.cb_server = CBServer(self)
>          self.thread = threading.Thread(target=self.cb_server.run, name=name)
> -        self.thread.setDaemon(True)
> +        self.thread.daemon = True
>          self.thread.start()
>          # Establish callback control socket
>          self.cb_control = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py
> index ba49cf9..bcc768a 100644
> --- a/nfs4.0/servertests/st_delegation.py
> +++ b/nfs4.0/servertests/st_delegation.py
> @@ -40,7 +40,7 @@ def _recall(c, thisop, cbid):
>      if res is not None and res.status != NFS4_OK:
>          t_error = _handle_error(c, res, ops)
>          t = threading.Thread(target=t_error.run)
> -        t.setDaemon(1)
> +        t.daemon = True
>          t.start()
>      return res
>  
> @@ -409,7 +409,7 @@ def testChangeDeleg(t, env, funct=_recall):
>      new_server = CBServer(c)
>      new_server.set_cb_recall(c.cbid, funct, NFS4_OK);
>      cb_thread = threading.Thread(target=new_server.run)
> -    cb_thread.setDaemon(1)
> +    cb_thread.daemon = True
>      cb_thread.start()
>      c.cb_server = new_server
>      env.sleep(3)
> diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py
> index e57b90a..6b4cc81 100644
> --- a/nfs4.1/nfs4state.py
> +++ b/nfs4.1/nfs4state.py
> @@ -308,7 +308,7 @@ class DelegState(FileStateTyped):
>                  e.status = CB_INIT
>                  t = threading.Thread(target=e.initiate_recall,
>                                       args=(dispatcher,))
> -                t.setDaemon(True)
> +                t.daemon = True
>                  t.start()
>          # We need to release the lock so that delegations can be recalled,
>          # which can involve operations like WRITE, LOCK, OPEN, etc,
> diff --git a/rpc/rpc.py b/rpc/rpc.py
> index 1fe285a..3621c8e 100644
> --- a/rpc/rpc.py
> +++ b/rpc/rpc.py
> @@ -598,7 +598,7 @@ class ConnectionHandler(object):
>              log_p.log(5, "Received record from %i" % fd)
>              log_p.log(2, repr(r))
>              t = threading.Thread(target=self._event_rpc_record, args=(r, s))
> -            t.setDaemon(True)
> +            t.daemon = True
>              t.start()
>  
>      def _event_rpc_record(self, record, pipe):
> @@ -935,7 +935,7 @@ class Client(ConnectionHandler):
>  
>          # Start polling
>          t = threading.Thread(target=self.start, name="PollingThread")
> -        t.setDaemon(True)
> +        t.daemon = True
>          t.start()
>  
>      def send_call(self, pipe, procedure, data=b'', credinfo=None,
> -- 
> 2.41.0

  reply	other threads:[~2023-09-13 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 10:46 [PATCH] Stop using deprecated thread.setDaemon Alexander Zeijlon
2023-09-13 15:13 ` J. Bruce Fields [this message]
2023-09-13 16:32 ` Calum Mackay
2023-09-14  6:19   ` Alexander Zeijlon
2023-09-15 11:36   ` Alexander Zeijlon
2023-09-15 18:14     ` Calum Mackay

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=20230913151334.GB3189@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=alexander.zeijlon@cendio.se \
    --cc=calum.mackay@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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