[PyQt] Function pointers and SIP
Phil Thompson
phil at riverbankcomputing.co.uk
Fri Jun 19 08:36:47 BST 2009
On Fri, 19 Jun 2009 03:27:02 +0200, Giovanni Bajo <rasky at develer.com>
wrote:
> On gio, 2009-06-18 at 19:01 +0100, Phil Thompson wrote:
>> On Thu, 18 Jun 2009 19:40:08 +0200, Giovanni Bajo <rasky at develer.com>
>> wrote:
>> > Hi Phil,
>> >
>> > given a C++ object where you can register callbacks such as:
>> >
>> > void registerCallback(void (*cb)(void*), void* user_data);
>> >
>> > or
>> >
>> > void registerCallback(std::tr1::function<void (void)> cb);
>> >
>> > how would you wrap them in SIP? Is there some code in PyQt that I can
>> > look at?
>>
>> I think you answered this yourself a couple of weeks back.
>
> I had a general idea of course, but I wanted to make sure there was not
> automa[tg]ic support by SIP which I wasn't aware of.
>
>> The nearest example in PyQt is probably qInstallMsgHandler().
>
> Thanks. Why the internal qtcore_MsgHandler uses
> SIP_BLOCK_THREAD/SIP_UNBLOCK_THREADS? Is that always needed or only if I
> have previously explicitly released the GIL?
It's not needed if you are absolutely sure the GIL has been acquired.
Phil
More information about the PyQt
mailing list