Manipulate GIL to have Python thread work with pthread native ones
Terry Reedy
tjreedy at udel.edu
Tue May 31 12:31:09 EDT 2016
On 5/31/2016 1:16 AM, qshhnkf at alumni.sjtu.edu.cn wrote:
> Hi Python experts,
>
> I need to extend Python with C/C++ to interact with an in-house
> legacy API. I'm implementing a data subscriber with Python, which
> subscribes to a data publisher (actually a ZeroMQ publisher socket)
> and will get notified once any new messages are fed. In my
> subscriber, the messages are dumped to a data processor after
> received. The subscriber will also get notified by the processor when
> done. Since the data processor is written in C++, I have to extend
> the Python code with a simple C++ module.
A couple of options you may not have considered. A. Run the C++ module
in a subprocess. Pass data either in pipes or files. B. Compile the
C++ module to a shared library and access via ctype module.
--
Terry Jan Reedy
More information about the Python-list
mailing list