[haiku-commits] Re: r42066 - haiku/trunk/src/apps/debugger/user_interface/gui

  • From: "Ingo Weinhold" <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 09 Jun 2011 17:41:43 +0200

Rene Gollent wrote:
> On Thu, Jun 9, 2011 at 10:11 AM, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> >
> > BMessenger::LockTarget[WithTimeout()] should be fixed in either case, 
> > though.
> >
> 
> I just had a look at this.... LockTarget() calls Target() to retrieve
> the looper ptr, and the latter retrieves the looper from the global
> looper list via its stored port. Since the port shouldn't be getting
> reused, LockTarget[WithTimeout()] should already be failing if the
> loopers don't match up, no?

The problem is that getting the looper (Target()) and locking it 
(looper->Lock()) is not an atomic operation. In between the looper could be 
deleted and another looper could be created with the same address. Hence the 
necessity to recheck whether the correct looper has been locked.

CU, Ingo

Other related posts: