Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109287

Re: Manipulate GIL to have Python thread work with pthread native ones

From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Manipulate GIL to have Python thread work with pthread native ones
Date 2016-05-31 12:31 -0400
Message-ID <mailman.55.1464712287.1839.python-list@python.org> (permalink)
References <1727544946.3450439.1464671782195.JavaMail.zimbra@alumni.sjtu.edu.cn> <nike8g$2v4$1@ger.gmane.org>

Show all headers | View raw


On 5/31/2016 1:16 AM, qshhnkf@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Manipulate GIL to have Python thread work with pthread native ones Terry Reedy <tjreedy@udel.edu> - 2016-05-31 12:31 -0400

csiph-web