How to write a Class(gobject) in a thread safe way?



/* I wrote a class to encapsulate a GString as a buffer.
 * I want to make it both thread safe and efficient.  I need several buffers
 * like this, so I don't want a global mutex to lock every instance of my buffer
 * class.  So I add a mutex as private member.
 *
 * But when I need to free my object (in maman_bar_finalize), how can I free
 * this mutex and the GString safely?  It might be locked at the same moment.
 *
 * The code below skimmed many detail.  But I think it could demonstrate my
 * problem. Thanks a lot! */

I pasted the code to pastetbin : http://pastebin.com/m56f7b37c

--
look to the things around you,the immediate world around you, if you
are alive,it will mean something to you ——Paul Strand


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]