Skip to content

Commit

Permalink
Use thread cache to vroom vroom faster
Browse files Browse the repository at this point in the history
  • Loading branch information
njsmith committed May 27, 2020
1 parent 5b75987 commit 9018066
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
PermanentlyDetachCoroutineObject,
WaitTaskRescheduled,
)
from ._thread_cache import start_thread_soon
from .. import _core
from .._deprecate import deprecated
from .._util import Final, NoPublicConstructor, coroutine_or_error
Expand Down Expand Up @@ -1173,12 +1174,7 @@ def in_main_thread():

self.run_sync_soon_threadsafe(in_main_thread)

# XX temporary placeholder until #1545 is merged
def start_thread_soon(d, fn):
t = threading.Thread(daemon=True, target=lambda: deliver(capture(fn)))
t.start()

start_thread_soon(deliver, get_events)
start_thread_soon(get_events, deliver)

def force_guest_tick_asap(self):
if self.guest_tick_scheduled:
Expand Down

0 comments on commit 9018066

Please sign in to comment.