Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: dieter Newsgroups: comp.lang.python Subject: Re: Manipulate GIL to have Python thread work with pthread native ones Date: Wed, 01 Jun 2016 09:50:56 +0200 Lines: 13 Message-ID: References: <1727544946.3450439.1464671782195.JavaMail.zimbra@alumni.sjtu.edu.cn> <87y46pz6sf.fsf@handshake.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de 0PgfvFgVMC3O8xSFK6LG0gDDZgZ9h9I1u1y4YsMHXcrg== Cancel-Lock: sha1:S9KZk1TXwasSr4IFGs9+KUvXEnI= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'annotations': 0.09; 'callback': 0.09; 'facilitates': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'python.': 0.11; 'gil.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:GIL': 0.16; 'c++,': 0.22; 'passing': 0.23; 'xml': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:" 20': 0.26; 'gil': 0.29; 'task': 0.30; 'ist': 0.31; 'implement': 0.32; 'integrate': 0.35; 'library.': 0.35; 'subject:work': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'there,': 0.37; 'received:org': 0.37; 'release': 0.37; 'charset:us-ascii': 0.37; 'integration': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'received:de': 0.40; 'binding': 0.66; 'subject:have': 0.80 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57b38397.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <87y46pz6sf.fsf@handshake.de> X-Mailman-Original-References: <1727544946.3450439.1464671782195.JavaMail.zimbra@alumni.sjtu.edu.cn> Xref: csiph.com comp.lang.python:109304 qshhnkf@alumni.sjtu.edu.cn writes: ... Python/C++ integration ... When I learn about a task to integrate Python with C or C++, I first think of "cython". "cython" facilitates those integrations. Especially, it has annotations to control the GIL. I have used "cython" for the implementation of a Python binding to the XML security library. The result ist "dm.xmlsec.binding". There, I use both ("cython") annotations to release the GIL when passing over control from Python to C; as well as ("cython") features to implement a callback from C to Python.