Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Call me bored, but don't call me boring. -- Larry Wall in <199705101952.MAA00756@wall.org>


devel / comp.lang.python / Re: Using a background thread with asyncio/futures with flask

SubjectAuthor
o Re: Using a background thread with asyncio/futures with flaskFrank Millman

1
Re: Using a background thread with asyncio/futures with flask

<mailman.20.1711265804.3468.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29730&group=comp.lang.python#29730

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: frank@chagford.com (Frank Millman)
Newsgroups: comp.lang.python
Subject: Re: Using a background thread with asyncio/futures with flask
Date: Sun, 24 Mar 2024 09:34:06 +0200
Lines: 15
Message-ID: <mailman.20.1711265804.3468.python-list@python.org>
References: <8a7231df-c30c-4fa6-9daa-546b3453b547@thomasnyberg.com>
<09efe843-195e-48c0-a9cb-6fe05e3a6921@solute.de>
<dcdef19d-cca1-4ce3-af8d-ae79abf79ec8@thomasnyberg.com>
<1322c7e8-2153-400d-afc5-7f2993031c08@chagford.com>
<ae25a260-5e04-4092-88c5-ed795408b5e1@chagford.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 4yTKXKxzeXHTPJkSl2QG5gOOEUjXXnqdEifauOSWqNbQ==
Cancel-Lock: sha1:snldU6QlF9rnLnDZAcDj0vwnA4Y= sha256:FaegtoRXGosGUUPtZZ9igVKDMrihdA6O9Zn/RrmTQM8=
Return-Path: <frank@chagford.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=chagford.com header.i=@chagford.com header.b=Ewbgc6d9;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'loop': 0.07;
'from:addr:chagford.com': 0.16; 'from:addr:frank': 0.16;
'from:name:frank millman': 0.16; 'message-id:@chagford.com': 0.16;
'millman': 0.16; 'received:196.35': 0.16; 'received:196.35.198':
0.16; 'received:197.90': 0.16; 'received:197.90.32': 0.16;
'received:197.90.32.26': 0.16; 'received:synaq.com': 0.16;
'subject:thread': 0.16; 'thread.': 0.16; 'wrote:': 0.16; 'pm,':
0.19; 'to:addr:python-list': 0.20; 'header:User-Agent:1': 0.30;
'passes': 0.32; 'python-list': 0.32; 'retrieve': 0.32;
'subject:Using': 0.32; 'but': 0.32; 'header:In-Reply-To:1': 0.34;
'using': 0.37; 'reference': 0.60; 'above': 0.62; 'received:196':
0.69; 'future': 0.72
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=synaq.com; s=securemail; t=1711265803;
b=cQNeD4jPP2AOBWIutMt8/ynAb2QCs+lPzfKLSicqxkBTSaAHqusMczwyuQeVLIbA7HbQUdV25+
zQYJE4N3ABKleibR+CS/+wfjiHLnVmPrlp8NB+NgiB9kjHCLcmBQ3Bf8FQ3qnWL4hJn96GVXx+
8yGvGgaJ0pI1/DpO11ZbDpbtMmq3JuAigFuau5USI3aAI3cu+/B2v1YdCMFDjDeNYVyZprkgWA
yiBhj6NAh9n9CHRR5tiMuU/rxEi71Qa1nzczK4tjCvTZ4VP0IppBTPjof+AwZNv/1VCyt8XcnM
OR+KEBeyBGUJFlsrx/YqA6zSiqp45SYyx6fOZSyFlP3dbw==;
ARC-Authentication-Results: i=1; synaq.com;
iprev=fail smtp.remote-ip=197.90.32.26;
auth=pass (PLAIN) smtp.auth=frank@chagford.com;
arc=none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=synaq.com; s=securemail;
t=1711265803;
bh=t7Qx1QcCt1Vsvv+gLdsahi4rytFVmK5QUpRJr7hPrtY=;
h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:To:
Subject:MIME-Version:Date:Message-ID:DKIM-Signature;
b=ap5j+XJ/+8MWQq3hok9TJQEQ2MwX5al4CRl/dkesDhDPxaTQo9ls3HmnswGsiScsr6aXBjbXk4
aV7VZYZMOYD8iklpcSiMJKjKvjA5jJ3j4BCk8dGHj0G/5OUj6auIcZ0EuNMJZJk53LbS4hE/gE
hADMt/JH8w9SQQpBgJxqTzeyPwmtWyx9Y2ZeBkAsG9hXuZNUeTF1A05YTS+ZIxE2yQLdLVpOo2
uUquYbd2+yDOFAuNdM3fMw8WxWbro1/6GcmXVN/Oqe5KqzX35MvpOZeAPqMoKkYjv31asF7XqA
FO7CDZx9dKWu63pilNPvrO7o4+E/D86phdFXxWPPtSPPVw==;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=chagford.com; s=securemail; h=In-Reply-To:From:To:Date:Message-ID;
bh=2MTV9LQqP7RkIAsC8D1RDR0Bt8W6PxcZg89uKCVxcV4=; b=Ewbgc6d9SnW+HRkOlZTbbN+Z4h
Fw054Oin/aeMv4Xfea86IAnXx4lYm8XHG+9t7Mp2f0Jhpn6rKEutsuOh67c1dWlD1pPGuJceRY1+m
JVL6WWE4oo9/QTmFqevw9g5GpHH2ToA84KRlJNvYWMIMslSG+23+UsJkVJeUt+TeSzNc/FKWpiqzL
ht0rl1obttAVla/nJ90V3FE9eJOd871VbCzZVFlZsfMfz5S9BL/Uq89vtp9nsr3m+K0MUtJaKiuFR
4GSU6d087U16Aevpsc5pBTPObmL0sUJ5lp8peu4MnlPhop7qVOIQEg3GC8JS7uDQ32BhqCV5mhuF+
pUlTxaDw==;
Authentication-Results: synaq.com; iprev=fail smtp.remote-ip=197.90.32.26;
auth=pass (PLAIN) smtp.auth=frank@chagford.com;
arc=none
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <1322c7e8-2153-400d-afc5-7f2993031c08@chagford.com>
X-Red-Router: yes
X-SYNAQ-Pinpoint-Information: Please contact SYNAQ for more information
X-SYNAQ-Pinpoint-ID: 1roIMx-000o2R-Sy
X-SYNAQ-Pinpoint: No virus infections found
X-Pinpoint-From: frank@chagford.com
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <ae25a260-5e04-4092-88c5-ed795408b5e1@chagford.com>
X-Mailman-Original-References: <8a7231df-c30c-4fa6-9daa-546b3453b547@thomasnyberg.com>
<09efe843-195e-48c0-a9cb-6fe05e3a6921@solute.de>
<dcdef19d-cca1-4ce3-af8d-ae79abf79ec8@thomasnyberg.com>
<1322c7e8-2153-400d-afc5-7f2993031c08@chagford.com>
 by: Frank Millman - Sun, 24 Mar 2024 07:34 UTC

On 2024-03-23 3:25 PM, Frank Millman via Python-list wrote:

>
> It is not pretty! call_soon_threadsafe() is a loop function, but the
> loop is not accessible from a different thread. Therefore I include a
> reference to the loop in the message passed to in_queue, which in turn
> passes it to out_queue.
>

I found that you can retrieve the loop from the future using
future.get_loop(), so the above is not necessary.

Frank

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor