A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-March/099024.html below:

[Python-Dev] Replacing threads with swapcontext()

[Python-Dev] Replacing threads with swapcontext()Nick Coghlan ncoghlan at gmail.com
Wed Mar 31 23:53:50 CEST 2010
Alexander Sabourenkov wrote:
> Hello.
> 
> I have went and replaced Python threads with explicitly-scheduled
> coroutines using swapcontext() family of functions (basically out of
> frustration with the greenlet).
> 
> I have two questions.
> 
> 1. Is it as dangerous to switch C stacks and not switch PyThreadState as
> I suspect? In particular, how tightly is PyThreadState::frame coupled to
> current C stack?

Off the top of my head, recursion limit checks will definitely go
haywire, and I would expect threading.local() and exception handling to
explode at some point (although the latter depends on what you mean by
"switching C stacks" - if you really are just fiddling the stack pointer
without affecting the thread local heap storage mechanisms, the latter
two should be fine. Still doesn't sound like a good idea though).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4