Re: Speedup insert into treestore
- From: Steven Walter <stevenrwalter gmail com>
- To: gtk-perl-list gnome org
- Subject: Re: Speedup insert into treestore
- Date: Wed, 12 Oct 2005 09:54:48 -0400
On Tue, 11 Oct 2005 09:34:41 -0400, muppet said:
>Congratulations! You've found a reference-handling bug in Glib::Object!
Attached is a patch which fixes this bug. To use the existing terminology, if the reference between the C object and perl object get "swapped" because the perl object is currently unused, be sure to swap it back when the perl object is used, so that the C object doesn't disappear from under it.
To implement this, it requires knowledge of whether a particular wrapper has had its reference swapped. If it has, I call this state "undead." When the reference is swapped back, the wrapper is "revived." To record the undead state, I set the least-most bit of the address of the wrapper in the C-object's qdata. This is safe (if not a bit magical) because no one uses this wrapper address until we revive the wrapper, at which point the low bit is cleared. Further, since most (all? please advise here) architectures use word-aligned pointers, we can be guaranteed that the lowest bit will always be zero in a valid pointer.
Glib with applied patch passes all tests, as well as all Gtk tests, as well as fixes muppet's indicated test case. Suggestions?
--
-Steven Walter <
stevenrwalter gmail com
>
"If you think healthcare is expensive now, you should see how much it costs when it's free."
- P.J. O'Rourke
Attachment:
gtk2-perl-locking.diff
Description: Text Data
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]