Den 13.08.2011 17:43, skrev Antoine Pitrou:
These days we have PyGILState_Ensure():
http://docs.python.org/dev/c-api/init.html#PyGILState_Ensure

With the most recent Cython (0.15) we can just do:

   with gil:
<suite>

to ensure holding the GIL.

And similarly from a thread holding the GIL

   with nogil:
<suite>

to temporarily release it.

There are also some OpenMP support in Cython 0.15. OpenMP is much easier than messing around with threads manually (it moves all the hard parts of multithreading to the compiler). Now Cython almost makes it look Pythonic:

http://docs.cython.org/src/userguide/parallelism.html


Sturla


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to