On Fri, 2007-03-16 at 09:36 -0400, Morten Welinder wrote: > Is there a guarantee that for GRegex (unlike, say, GDate) multiple > threads can use > the same object at the same time? > > I.e., two threads cannot call g_date_get_weekday on the same date, so why are > we > expect that two threads can call g_regex_copy or anything like it?
There are the following reasons to have separate regex and match objects: 1) Less prune to reentrancy problems 2) Less prune to writing inefficient code 3) More familiar to people who have used any scripting language 4) The GRegex object already has separate match and regex objects internally, and has to copy them differently to get good performance possible. This is at best a hack. So, what's the deal? The question is not "can we please change it?". It's "why is it this way?". And as someone already showed, safe simple wrappers can be written around the regex object for simple boolean queries. > Morten -- behdad http://behdad.org/ "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety." -- Benjamin Franklin, 1759 _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list