28.04.2014 15:48, Michael Tokarev wrote:
[]
> I've added a tiny (but hackish and fun) wrapper header for all
> this, and pushed whole thing into a branch on my site -- see
> 
>  http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/libcacard-standalone
> 
> The wrapper is here:
> 
>  
> http://git.corpit.ru/?p=qemu.git;a=blob;f=libcacard/glib-compat.h;h=47fd06a43572fc5cc639fb7d705e85f3965d6b91;hb=1aeefee2a4bb2694b2314cddd04e08675360e255

And the wrapper which actually works (tested on glib-2.24.2 on debian
squeeze (oldstable) system) is here:

http://git.corpit.ru/?p=qemu.git;a=blob;f=libcacard/glib-compat.h;h=8e92b2032a0b9b81e748f8dceb60a3a7d98d00c0

> It allows to use the new primitives/interface with either new (unchanged)
> or old (wrapped) glib cond and mutex API.
> 
> I think this is better than a way used in trace/simple.c, and can be
> used there too, making stuff much more readable.
> 
> Please note: the wrapper redifines some core symbols which are used in
> glib so it must come somewhere near the end of #include set.  Most
> interesting is that it redefines GCOnd into GCond* (only for old glib).

I had to do the same for GMutex.  Previous attempt to make this work with
GStaticMutex didn't work because g_cond_wait() expects a GMutex*, not
GStaticMutex.

And also had to add g_thread_new() wrapper.

And finally, had to revert one commit, 2e679780ae86c6ca8, which converted
strncpy() to pstrcpy().

Thanks,

/mjt

Reply via email to