Re: [sigc] Re: [gtkmm] libsigcx and gtkmm 2.4



Am So, den 13.06.2004 um 22:18 Uhr +0200 schrieb Martin Schulze:

> time    thread A should do (*does)               thread B [*does]
> -------------------------------------------------------------------
> t       construct slot
>                     (*slot is partly constructed)
> t+2     acquire lock
>                     (*lock is acquired)
> t+3     add slot to list
> t+3     release lock
>                     (*slot is added to list)
>                     (*lock is released)
> t+4     idle                                      [*accesses slot]
> t+5                 (*construction of slot is finished)
> 
> 
> Is this a possible scenario? I can't think properly about it at the  
> moment - too tired. Note that slot is copied again while adding to the  
> list during std::list::push_back(). I would assume that this copy is  
> fully initialized before the lock is actually released. Of course in  
> the case of our std::string this is still a problem because the newly  
> constructed string is a shallow copy of the old one. But for static  
> data types everything should be all right, shouldn't it?

Yes.  But at least in libsigc++ 1.2, slots were reference-counted.  Has
this changed in 2.0?

--Daniel





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