Python Forum
how this to make a asyncio thread safe?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how this to make a asyncio thread safe?
#1
this is the official call_soon_threadsafe

def call_soon_threadsafe(self, callback, *args):
    """Like call_soon(), but thread-safe."""
    self._check_closed()
    if self._debug:
        self._check_callback(callback, 'call_soon_threadsafe')
    handle = self._call_soon(callback, args)
    if handle._source_traceback:
        del handle._source_traceback[-1]
    self._write_to_self()
    return handle
but you cant get any thing that related to thread lock, how to make thread safe ? how this code works?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  When is it safe to compare (==) two floats? Radical 4 694 Nov-12-2023, 11:53 AM
Last Post: PyDan
  How to make each thread send multiple requests in python3? Contra_Boy 0 1,776 Apr-29-2020, 02:42 PM
Last Post: Contra_Boy
  Error SQLite objects created in a thread can only be used in that same thread. binhduonggttn 3 15,557 Jan-31-2020, 11:08 AM
Last Post: DeaD_EyE
  is try/except safe inside of another except? Skaperen 5 2,608 Aug-04-2019, 07:14 PM
Last Post: buran
  is it safe to close stdin Skaperen 1 2,659 Apr-04-2019, 06:57 AM
Last Post: Gribouillis
  Asyncio within a thread hollymcr 2 63,651 Mar-12-2018, 08:36 AM
Last Post: hollymcr
  Is it safe to use outside a class created inside the function? oneroslavsky 2 2,963 Dec-27-2017, 01:10 AM
Last Post: mpd

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020