From: neil Date: 2003-12-26T18:36:52+09:00 Subject: Re: TkText freezes Yukihiro Matsumoto wrote: > Hi, > > In message "Re: TkText freezes" > on 03/12/25, ts writes: > > | I'm probably wrong, but I don't think it's related to pthread. > | > | The example given can crash with svg and Tk/Tcl is not compiled with > | pthread > > We have two problems, one that crash, and the other that block. The > former is not related at all with pthread. It's a bug in Ruby. > I think it's fixed by the following patch. The bug I'm suspecting to > be LinuxThread bug is the latter. > > matz. > diff -p -u -1 -r1.182 string.c > --- string.c 30 Nov 2003 00:35:28 -0000 1.182 > +++ string.c 25 Dec 2003 08:24:39 -0000 > @@ -1277,4 +1581,4 @@ rb_str_aref_m(argc, argv, str) > > -void > -rb_str_update(str, beg, len, val) > +static void > +rb_str_splice(str, beg, len, val) > VALUE str; > @@ -1322,2 +1626,12 @@ rb_str_update(str, beg, len, val) > > +void > +rb_str_update(str, beg, len, val) > + VALUE str; > + long beg, len; > + VALUE val; > +{ > + rb_str_modify(str); > + return rb_str_splice(str, beg, len, val); > +} > + > static void > @@ -1353,3 +1667,3 @@ rb_str_subpat_set(str, re, nth, val) > rb_str_modify(str); > - rb_str_update(str, start, len, val); > + rb_str_splice(str, start, len, val); > } > @@ -1384,3 +1698,3 @@ rb_str_aset(str, indx, val) > else { > - rb_str_update(str, idx, 1, val); > + rb_str_splice(str, idx, 1, val); > } > @@ -1397,3 +1711,3 @@ rb_str_aset(str, indx, val) > } > - rb_str_update(str, beg, RSTRING(indx)->len, val); > + rb_str_splice(str, beg, RSTRING(indx)->len, val); > return val; > @@ -1405,3 +1719,3 @@ rb_str_aset(str, indx, val) > if (rb_range_beg_len(indx, &beg, &len, RSTRING(str)->len, 2)) { > - rb_str_update(str, beg, len, val); > + rb_str_splice(str, beg, len, val); > return val; > @@ -1426,3 +1765,3 @@ rb_str_aset_m(argc, argv, str) > else { > - rb_str_update(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]); > + rb_str_splice(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]); > } > @@ -1449,3 +1805,3 @@ rb_str_insert(str, idx, str2) > } > - rb_str_update(str, pos, 0, str2); > + rb_str_splice(str, pos, 0, str2); > return str; > > > A patched ruby 1.8.1 (2003-12-05) [i686-linux] works fine for me on original program and example/ glibc-2.3.2.-14mdk tcl/tk 8.4.2.-1mdk kernel 2.4.22-10 Neil