[interfacekit] Re: locking...
- From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
- To: interfacekit@xxxxxxxxxxxxx
- Date: Thu, 19 Jun 2003 18:45:42 +0200 (MEST)
On Thu, 19 Jun 2003, Adi Oanca wrote:
> Question:
>
> My BView::Origin is defined like this:
>
> BPoint BView::Origin(void) const {
> if (owner){
> owner->AssertLocked();
> }
> return fBounds.LeftTop();
> }
>
>
> Be's like:
>
> BView::Origin(void) const {
> BLooper::check_lock(void)
> _BSession_::swrite_l(long)
> _BSession_::swrite_l(long)
> _BSession_::swrite_l(long)
> BWindow::Flush(void) const
> _BSession_::sread(long, void *)
> }
>
> In Be's implementation, it is clear that a lock is required.
> In my method, is it required?
Yes. Besides the fact, that neither SetOrigin(), nor Origin() access the
variable in an atomic way, locking also ensures that the object won't be
deleted while being accessed.
CU, Ingo
- References:
- [interfacekit] locking...
- From: Adi Oanca
Other related posts:
- » [interfacekit] locking...
- » [interfacekit] Re: locking...
- » [interfacekit] Re: locking...
- [interfacekit] locking...
- From: Adi Oanca