Re: Thread specific data for GLib



Hi, Owen 

> While testing out the thread-safety patches to GLib,
> I ran into one problem that I don't see how to
> solve without adding thread-specific data to our
> set of primitives -

Ah, I havn't seen that yet, but I already wrote "MT safe" into the header,
makes me wonder, how reliable my other "MT safe" remarks are ;-)

[ snip ]
> It would then be easy to provide,
> on top of that, a more "G-ish" interface that provided
> the optional ability to associate data with character
> keys instead of numeric ID's. (I.e., something along
> the lines of GDataSet / GDataList)

Thats not good, that is asking for trouble (is this case it is asking for
name space collisions). I have however added a (I think) quite G-ish
addition, that again can be statically initialized, it of course needs a
mutex call there, but that is an acaptable cost, because you gain a quite
nice interface. You can alos set a constuctor, that is used every time the
private data is read and would be NULL. and you can destroy a key and all
data related to it (thats not possible under either solaris or posix).
You'll soon find a patch in 

ftp.gtk.org/incoming/glib-wilhelmi-981207.patch*

Bye,
Sebastian

PS.: There still are some rough edges, but in general I am quite content
with my solution. ;-) (so at least someone is)

-- 
+--------------============####################============--------------+
| Sebastian Wilhelmi, Institute for Computer Design and Fault Tolerance, |
| University of Karlsruhe;  Building 20.20, Room 263,  D-76128 Karlsruhe |
| mail: wilhelmi@ira.uka.de;  fax: +49 721 370455;  fon: +49 721 6084353 |
+-----------------> http://goethe.ira.uka.de/~wilhelmi <-----------------+



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