Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Cohabitation with Python and C++ (oyster.com)
10 points by benhoyt on Nov 24, 2011 | hide | past | favorite | 6 comments


It's quite easy to release the GIL while you are running non-python code.[1] Just be sure that if you touch the Python API that you reaquire the GIL.[2]

[1] http://docs.python.org/c-api/init.html#releasing-the-gil-fro...

[2] http://docs.python.org/c-api/init.html#PyGILState_Ensure


When you say HTTP API, does that mean you had C++ http server, C++ http client, Python http server and Python http client?


Good question: In this case C++ was the server, and Python (via urllib2) was the client.


Out of curiosity, why didn't you fork and use a pipe?


We're running on Windows, and fork isn't available there. Also, in this case AFAIK fork doesn't really apply, as we wanted to start the C++ and Python servers completely separately.


Thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: