stackless over ctypes - threading
Hi PyPy Devs, I have an example of using a compiled Rpython extension module in Python using stackless (rcoroutines). From ctypes i can safely read the values of a shared-object (shared between CPython and RPython), but i can not in a thread-safe way set values on the shared object so that RPython can see them. I was wondering what is the best way to handle the thread locking. http://pyppet.blogspot.com/2011/04/stackless-compiled-modules.html thanks, -brett
Hi Brett, On Mon, Apr 25, 2011 at 9:45 AM, Hart's Antler <bhartsho@yahoo.com> wrote:
I have an example of using a compiled Rpython extension module in Python using stackless (rcoroutines). From ctypes i can safely read the values of a shared-object (shared between CPython and RPython), but i can not in a thread-safe way set values on the shared object so that RPython can see them. I was wondering what is the best way to handle the thread locking.
Sorry, no clue. We don't know exactly what you are doing, but I can tell you that poking around with CPython's ctypes in the GC objects of a translated PyPy will just get you randomness. It might work a bit by chance with today's version of PyPy (e.g. as long as there are not multithreading issues, as long as you are on 32-bits and not 64-bits or vice-versa, as long as you use only the default GC options, etc.). It's not something that we want to support. A bientôt, Armin.
participants (2)
-
Armin Rigo
-
Hart's Antler