Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHow to get "trio token" for trio.to_thread.run_sync? #1439
Comments
|
Use |
|
Sounds like the docs could use a small update to point to that? |
|
Yeah, a pointer would be great. I still feels somewhat counterintuitive that I have to fallback on |
|
@Nikratio We renamed hazmat to lowlevel recently to emphasize the fact that there's nothing wrong with that module :) |
Hello,
I am trying to migrate from trio.BlockingTrioPortal to trio.from_thread(). Unfortunately I am running into some trouble because I am trying to call from a not-trio-created thread.
The documentation specifies that I can "pass a keyword argument, trio_token specifiying a specific trio.run loop to re-enter". But how do I get such a token? It doesn't seem mentioned anywhere else (including the description of trio.run).
I think I am looking for a function like
trio.get_current_token()whose output I can save and pass to a thread for use with `trio.from_thread.run_sync.