[haiku-appserver] Re: we need to think, I think...

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Wed, 15 Jun 2005 15:31:35 +0200 CEST

Hi Adi,

> > I think you make a mistake in the way you approach concurency and 
> > synchronizing issues.
> 
>       I know I did a mistake, but I know I'm not totally wrong. :-)

Hey - nobody said "totally". :-)

> > The RootLayer thread manages data. This data is 
> > accessed from other threads as well, such as the ServerWindow 
> > threads. 
> > One example being the clipping regions that are calculated in the 
> > RootLayer thread. You seem to think that when you send the 
> > RootLayer 
> > thread a message to do the calculation, you don't need to lock the 
> > data, but this is wrong.
> 
>       Why?
>       I don't need to lock the data because I _know_ RL's thread will
> lock it for me. RL's lock represents the data_lock also.

Yes, that seems to be the case. I would like to investigate these 
things some more. I have the feeling I don't fully understand all the 
code yet.

>       However, there is still a problem, IMO.
>       We create another "lock", clippingDataLock, a MultiLocker.
> Now, the question: should the clipping calculations be done outside 
> RL's
> thread(remember my original email) too, or not?

I think that it is fine that the calculation (write access) is done in 
the same thread always, which would be the RootLayer thread. It should 
be an atomic operation, and we don't need to complicate things. 

Best regards,
-Stephan


Other related posts: