Re: [sigc] Re: [gtkmm] libsigcx and gtkmm 2.4
- From: Daniel Elstner <daniel elstner gmx net>
- To: Martin Schulze <martin-ml hippogriff de>
- Cc: libsigcx-main lists sourceforge net, libsigc-list gnome org, Gtkmm List <gtkmm-list gnome org>
- Subject: Re: [sigc] Re: [gtkmm] libsigcx and gtkmm 2.4
- Date: Sun, 13 Jun 2004 19:45:57 +0200
Am So, den 13.06.2004 um 18:30 Uhr +0200 schrieb Martin Schulze:
> >
> > > knows of it. Note that sigc::bind does not take arguments as
> > references
> > > by default if this is where you are heading.
> >
> > std::string can be implemented with reference counting, and the
> > libstdc++ shipped with GCC does exactly that.
>
> Meaning that no deep copy of the string is made although it is passed
> "by value"?! Then I understand the problem here.
Exactly.
> (However, if you pass a "const char*" into the std::string ctor as in
> my example the copy is being created at once, isn't it?)
Right. But you have to lock *before* creating the std::string object!
> I still don't see the problem in the case where no references/pointers
> are being passed around: The list of slots the dispatcher operates on
> _is_ protected by memory barriers (there might be bugs in my code but
> it is perfectly possible to simply use a mutex around 'std::list::
> push_back()' / 'std::list::pop_front()' as I pointed out in a comment
> and as Christer does).
Sure, but the caller passes in an already constructed std::string. As I
said above, you need to lock before constructing the object. The only
alternative is a deep copy (that's what I'm proposing for the improved
Glib::Dispatcher implementation).
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]